Make iPhone vibrate: AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) uneclared

I want to make the iPhone vibrate and I found the code

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 

but Xcode 4.3.2 reports an error: undeclared identifier kSystemSoundID_Vibrate

What is the problem?

+7
source share
1 answer

Try:

 AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); 

EDIT . Also make sure you import AudioToolbox.framework

  • #import <AudioToolbox/AudioToolbox.h>
+21
source

All Articles