Search code examples
iosobjective-ccocoa-touchios7ios-simulator

Audio stops on background on simulator (iOS 7.1)


Audio stops when you close app. And may start again if you just open Control Center (swipe from bottom). It's really strange.

Everything's fine in iOS 8 simulator and devices. The problem is I can't install iOS 7 on existing devices to test is it a bug in my app or it's a bug in simulator.

UIBackgroundModes in info.plist contains audio string object. Here is how I configure a session on app start:

- (void)setAudioSession {
    [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
    [[AVAudioSession sharedInstance] setActive:true error:nil];
}

To play audio I use AVPlayer class.


Solution

  • It's iOS 7 simulator only bug.