3
votes

I would like to play a sound when someone click home button of iphone/ipad, e.g. when application goes in background.

I have already added "App plays audio" required background in my info.plist.

I am trying to play an audio file in applicationWillResignActive and applicationDidEnterBackground methods using AVAudioPlayer. But no success yet.

Any solution to this?

1
same question like this:-stackoverflow.com/questions/7619794/…Leena

1 Answers

3
votes

You need to initialize your audio file in didFinishLaunchingWithOptions and play it in applicationWillResignActive.