Can I play a sound with vibrate using AVAudioPlayer?
问题 I have AVAudioPlayer playing a sound for a message alert during chat, I also want the phone to vibrate. Is it possible to do this in AVAudioPlayer or do I need to use a different method? Thanks 回答1: To play a sound: NSString *source = [[NSBundle mainBundle] pathForResource:@"beep" ofType:@"mp3"]; self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:source] error:nil]; self.audioPlayer.delegate = self; self.audioPlayer.numberOfLoops = 0; self.audioPlayer