When I schedule a UILocalNotification, I know that I can specify a sound to play when the notification is delivered to the user. According to the UILocalNotification API document, I can schedule a local notification with a sound attached to it:
let notification = UILocalNotification()
notification.fireDate = date
notification.timeZone = NSTimeZone.localTimeZone()
notification.alertTitle = "My Alarm"
notification.alertBody = "my text message"
notification.soundName = "my-sound.aif"
let app = UIApplication.sharedApplication()
app.scheduleLocalNotification(notification)
This works well, but there's a limitation: it seems that you can specify only the sound files you already shipped in the application when you submitted the app to the app store.
What I'm trying to do is, I'd like to record users' own voice message into a sound file and specify it in the local notification so that , when the OS delivers the notification to the user, the user can hear his or her own recorded messages. I saw other questions and answers in SO about how to change the sound, but they only talk about changing the sound among the resources that are shipped with the app at the submit time, and not about using dynamically generated sound. Does anyone know if I can attach a generated sound file to a local notification?, and if yes, how to do it?