1
I’m having a problem making an app similar to an alarm. What happens is that I can’t find any way for the user to select a song in their library and use it when playing a notification. This is possible at Swift?
What I implemented was an excerpt that carries an internal sound file, but I’d like to get a song from the library:
let content = UNMutableNotificationContent()
content.title = "Late wake up call"
content.body = "The early bird catches the worm, but the second mouse gets the cheese."
content.categoryIdentifier = "alarm"
content.sound = UNNotificationSound.init(named: "my-music.mp3");
Another issue is that I did not find something related to the iOS alarm, in which it opens a screen with a STOP or FORWARD button even being in the background. On Swift this is possible?
Thank you very much for the information, just a question. There is an app called "Alarm Clock for me", it lets me upload a song from my library as a ringtone. But this only works when the app is open, in case I leave in the background the music does not work. So the process it does is to call a specific method that plays the music, through a Scheduler?
– Rodrigo
This will only work if the app is running, if it is in the background does not work. If you want you can even use the notification to schedule, when you receive the notification you play the song.
– Marcos Trovilho