7

I'm writing a sprite kit-based app in swift and need to make a short haptic feedback using vibration

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.

Then after some searching I read Kevin Cao's answer here:

Are there APIs for custom vibrations in iOS?

but unfortunately AudioServicesPlaySystemSoundWithVibration private function was only usable in iOS 6.

so is there any other possible way?

Community
  • 1
  • 1
Ahmad Ismail
  • 641
  • 7
  • 15

1 Answers1

2

You need AudioServicesPlaySystemSoundWithVibration API. But unfortunately it's private and you can not publish your app :(

Check this blog post and this answer

Community
  • 1
  • 1
pulp
  • 1,768
  • 2
  • 16
  • 24