void AudioServicesStopSystemSound(int);
void AudioServicesPlaySystemSoundWithVibration(int, id, NSDictionary *);
3.调用
NSMutableDictionary* dict = [NSMutableDictionary dictionary];
NSMutableArray* arr = [NSMutableArray array ];
[arr addObject:[NSNumber numberWithBool:YES]]; //vibrate for 2000ms
[arr addObject:[NSNumber numberWithInt:2000]];
[dict setObject:arr forKey:@"VibePattern"];
[dict setObject:[NSNumber numberWithFloat:0.3] forKey:@"Intensity"];
AudioServicesStopSystemSound(kSystemSoundID_Vibrate);
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
NSArray *pattern = @[@YES, @30, @NO, @1];
if ([[UIDevice currentDevice] platformType] == UIDevice5SiPhone)
{
// iPhone 5S has a weaker vibration motor, so we vibrate for 10ms longer to compensate
pattern = @[@YES, @40, @NO, @1];
}
dictionary[@"VibePattern"] = pattern;
dictionary[@"Intensity"] = @1;
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, dictionary);