play music in background in iphone using AVAudioplayer
<p>I want to play music  even if the app goes in background. I checked all stackoverflow links but none of them worked. Please help need to do it today.</p>

<p>I had used following code:-</p>

<pre><code>NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"Day At The Beach"  ofType: @"mp3"];

NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];

NSError *error;
playerTemp = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&amp;error];
playerTemp.numberOfLoops = 0;
AudioSessionSetActive(true);
[playerTemp play];
</code></pre>

<p>Thanks.</p>
