thisiscrazy4
thisiscrazy4

Reputation: 1965

Start playing MPMusicPlayerController when app is in background

Is it possible to start playing 'MPMusicPlayerController' when the app is in a background state? I have an alarm clock app and I would like to start playing music when the alarm goes off and the app isn't in the foreground.

Upvotes: 0

Views: 263

Answers (1)

Anindya Sengupta
Anindya Sengupta

Reputation: 2589

Go to project properties -> Capabilities and switch on the Application Background Modes

enter image description here

Then in your plist file add the following key:

enter image description here

Now just play the music in when your timer sets off.

Upvotes: 1

Related Questions