0

When I start my app on iphone at that time my AVAudioPlayer gets closed. and I want that when I start my app in background AVAudioplayer should be on and when I close my app AVAudioPlayer started automatically. Why does this happen. can anyone tell me?

DShah
  • 9,768
  • 11
  • 71
  • 127
iPhone
  • 4,092
  • 3
  • 34
  • 58

1 Answers1

0

use following to activate sharedInstance of AudioPlayer while app is in background

[[AVAudioSession sharedInstance] setActive: YES error: nil];

Also for more code refer Play one instance of AVAudioPlayer in the background

Community
  • 1
  • 1
DShah
  • 9,768
  • 11
  • 71
  • 127