iOS 8中的自定义振动 - Swift

Ahm*_*ail 7 vibration swift ios8

我正在swift中编写一个基于sprite kit的应用程序,需要使用振动进行简短的触觉反馈

所以首先我导入AudioToolbox并使用它

AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
Run Code Online (Sandbox Code Playgroud)

它运作良好,但它振动太久,无法控制这个持续时间.

经过一番搜索,我在这里读到了Kevin Cao的答案:

iOS中是否有用于自定义振动的API?

但不幸的是,AudioServicesPlaySystemSoundWithVibration私有功能仅在iOS 6中可用.

还有其他可能的方法吗?

pul*_*ulp 2

您需要 AudioServicesPlaySystemSoundWithVibration API。但不幸的是它是私有的,您无法发布您的应用程序:(

查看这篇博文这个答案