Search code examples
ioscocos2d-iphone

About : AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);


In my project, I used AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) to play SystemSound.When test in iPhone5,it works.
when in the iPhone4,it can‘t work .
Thanks for your help:

here is the code:

        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

I have import AudioToolbox.AVFoundation.framework,#import

but it is no use


Solution

  • this are the two ways to make your device vibrate

    1) AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
    2) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
    

    also you need to import

     #import <AudioToolbox/AudioServices.h>