【问题标题】:Custom vibration in iOS 8 - SwiftiOS 8 中的自定义振动 - Swift
【发布时间】:2015-05-15 20:30:19
【问题描述】:

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

所以我首先导入了 AudioToolbox 并使用了这个

AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))

它运行良好,但振动时间过长,无法控制此持续时间。

然后经过一番搜索,我在这里阅读了凯文曹的答案:

Are there APIs for custom vibrations in iOS?

但不幸的是,AudioServicesPlaySystemSoundWithVibration 私有函数只能在 iOS 6 中使用。

那么还有其他可能的方法吗?

【问题讨论】:

    标签: swift ios8 vibration


    【解决方案1】:

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

    检查this blog postthis answer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-09
      • 1970-01-01
      相关资源
      最近更新 更多