问题描述
我正在swift编写一个基于精灵工具包的应用程序,需要使用振动进行简短的触觉反馈
I'm writing a sprite kit-based app in swift and need to make a short haptic feedback using vibration
所以首先我导入了AudioToolbox并使用了这个
so first I imported AudioToolbox and used this
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
它运作良好,但它振动太久,无法控制这个持续时间。
and it worked well but it vibrates for too long and there's no way to control this duration.
然后经过一番搜索,我读了Kevin Cao的在这里回答:
Then after some searching I read Kevin Cao's answer here:
但遗憾的是AudioServicesPlaySystemSoundWithVibration专用功能仅在iOS 6中可用。
but unfortunately AudioServicesPlaySystemSoundWithVibration private function was only usable in iOS 6.
那么还有其他可能的方法吗?
so is there any other possible way?
推荐答案
您需要AudioServicesPlaySystemSoundWithVibration API。
但不幸的是,它是私密的,你无法发布你的应用程序:(
You need AudioServicesPlaySystemSoundWithVibration API.But unfortunately it's private and you can not publish your app :(
检查和
这篇关于iOS 8中的自定义振动 - Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!