Description
STR
On a device running iOS 10 (must be an actual device, not the simulator), the following STR consistently lead to a crash:
- Navigate the host application until a 360 video is visible.
- Leaving the app in the foreground, lock the device with the lock button. Do not send the app to the background via the home button.
- CRASH.
- Unlock the device again and you'll be greeted by the iOS home screen because the application has exited prematurely.
Variations
This occurs whether or not the video is still playing or has been paused prior to the moment the lock button is pressed. It occurs whether or not the AVPlayer, its associated video node, or the entire SKScene have been paused.
Workaround
The only thing I have found that prevents the crash is to add background audio to the app's list of allowed background modes.
Crash Details
The crash is caused by an uncaught exception thrown by CoreAudio:
Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error 561015905'
That error code maps to AVAudioSessionErrorCodeCannotStartPlaying:
This error type can occur if the app’s Information property list does not permit audio use, or if the app is in the background and using a category which does not allow background audio.
This crash does not affect standard videos, so my assumption is that there is something about SceneKit's usage of AVPlayer/CoreAudio which leads to the crash.
Resolution
I've exhausted everything I can think to try. I think we have four options:
- Petition Apple to address the issue with a radar, and hope for the best.
- Enable background audio, at least temporarily.
- 1 and 2.
- Do nothing and hope it goes away before iOS 10 GM.