所谓调用手机的震动,其实就是调用系统声音的一种。就一句代码:
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
仅支手机(ipnone)。 ipad 、touch 都不支持
NSString *devieModel = [[UIDevice currentDevice]model];
NSLog(@"device %@",devieModel);
if ([devieModel isEqualToString:@"iPhone"])
{
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}else
{
UIAlertView *alerView = [[UIAlertView alloc]initWithTitle:@"warning" message:@"Your device is not supported" delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
[alerView show];
}