How do you use AVAudioPlayer to play music in the background?

I am currently using AVAudioPlayer to play foreground music, but when I press the home button, my application goes to the background and the music stops. I set the category for my AVAudioSession to AVAudioSessionCategoryPlayback and set the active to YES. In addition, I added a key audioto UIBackgroundModes in my Info.plist.

Is there anything else I need to do to enable background music?

+3
source share
1 answer

- , .

(Edit: " ". , , , "" , "", ).

+2

Source: https://habr.com/ru/post/1758323/


All Articles