1
2
3
4
5
6
7
8
9
10
11
12
13
14
#import <AudioToolbox/AudioServices.h>
// 该定义可忽略系统的静音振动设置(设置-声音-振动)
#define kSystemSoundID_Vibrate 1352
// ... ...
- (void)vibrate {
// 方法一:若设备不支持震动,则静默失败。
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
// 方法二:若设备不支持震动,则以蜂鸣代替。
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
}