I'm writing a reminders app for iPhone that displays reminders using local notifications.
If a reminder goes off while the application is running, the local notification isn't displayed. Instead, the didReceiveLocalNotification
method is called in my app delegate, and I mimic the local notification dialog by displaying a UIAlertView
with the reminder text.
When local notifications are displayed outside of the app, the device vibrates and the sound specified by UILocalNotificationDefaultSoundName
is played. Again, I'd like to mimic this in the app when displaying the UIAlertView
.
I can vibrate the device by calling AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
, but I can't figure out how to play the local notification default sound. There's no equivalent SystemSoundID constant, and I'm not sure what the path would be.
tl;dr I'd like to play the local notification default sound when displaying a UIAlertView. Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…