Hi everyone,
I’m encountering a persistent issue with FMOD in my Unity project on iOS. When the app resumes from the background, the OS occasionally terminates it with the error: “The app was terminated while unresponsive.”
I suspect this is related to how I’m handling AVAudioSession reactivation. During resume, if setActive:TRUE fails with AVAudioSessionErrorCodeCannotStartPlaying, I am currently using a while loop to retry activation (as shown in the code below). I suspect this blocking loop is triggering the iOS Watchdog to kill the app.
Hi,
Can I get some more info from you? Specifically:
- Your FMOD version
- Your Unity version
- You iOS version
- What Category your AVAudioSession is using
Thanks!
Hi, here is the version information:
Unity version:6000.3.7f1
Unity_Fmod :2.03.11
IPhone 17 Pro max ,IOS 26.4
User-reported crash log from backend. Not sure what the AVAudioSession category is.
I would really appreciate it if you could help locate the issue.
Thanks for the additional info!
At the point of the usleep(), FMOD is unable to set the AVAudioSession as active due to circumstances outside of its control (i.e. some other app taking priority), and since the AVAudioSession is handled by iOS, it’s not really possible for FMOD to do anything else. I’d recommend modifying that section of the code to use periodically attempt to set the session as active without using usleep - the NSTimer class might be worth looking into.