Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS 8中的自定义振动-Swift_Swift_Ios8_Vibration - Fatal编程技术网

iOS 8中的自定义振动-Swift

iOS 8中的自定义振动-Swift,swift,ios8,vibration,Swift,Ios8,Vibration,我正在用swift编写一个基于精灵套件的应用程序,需要使用振动进行简短的触觉反馈 所以首先我导入AudioToolbox并使用它 AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) 它工作得很好,但振动时间太长,无法控制这种持续时间 经过一番探索,我在这里读到了凯文·曹的答案: 但不幸的是,AudioServicesPlaySystemSoundWithVibration专用功能仅在iOS 6中可用 那么还有其

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

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

AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
它工作得很好,但振动时间太长,无法控制这种持续时间

经过一番探索,我在这里读到了凯文·曹的答案:

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


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

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

检查和