Playing multiple vibrates on iPhone
How can I play two or three vibr开发者_JAVA技巧ates in a row? Or different patterns of vibrate?
Repeating AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
does not work. Only does a single vibrate.
Tried using callback
OSStatus AudioServicesAddSystemSoundCompletion (
SystemSoundID kSystemSoundID_Vibrate,
CFRunLoopRef inRunLoop,
CFStringRef inRunLoopMode,
AudioServicesSystemSoundCompletionProc vibrationDone,
void *inClientData
);
but it does not trigger vibrationDone.
Try registering a callback using AudioServicesAddSystemSoundCompletion
to be notified when the vibrate "sound" has ended before attempting to play it another time. From the docs:
Because a system sound may play for several seconds, you might want to know when it has finished playing. For example, you may want to wait until a system sound has finished playing before you play another sound.
NB: I haven't tried if this actually works.
精彩评论