Since upgrading to iOS 10 and Xcode 8, my iOS app has been throwing an error and crashing whenever I turn off the screen using the lock button. The error is:
*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'error 561015905'
I'm not explicitly using Core Audio, or any audio at all. But I am using SceneKit, which I assume uses Core Audio.
Actually this behavior doesn't seem to be related to my code at all. It happens on a brand new untouched SceneKit template! It doesn't happen in the simulator, but it happens consistently testing with an iPhone 5. I haven't tried it with another model.
Steps to reproduce: Create a new project in Xcode 8.0 using the "Game" template with SceneKit. Set your team in the project editor for code signing. Connect an iPhone 5 for testing. Build and run the app. Once it starts (and you see the rotating plane), hit the lock button. The error occurs and the app won't return from the lock screen.
Google results for the error message all seem to be from people actually using Core Audio or trying to play sound, which doesn't apply here.
What is this error and what can be done about it?
This is an Apple bug that has 2 workarounds while we wait for the fix in iOS 10.2:
(1) (worse) enable background audio
(2) (better) see Apple message below
message from Apple: This is a known issue that will be fixed in 10.2. In the meantime another simpler workaround should work: Trigger the audio engine creation yourself before entering the background (for example at setup). You can trigger this simply by getting the audio engine from the SCNView:
scnView.audioEngine;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With