Crash with CDAudioManager handleinterruption unrecognized

It crashed on Cocos2d version 3.16. To reproduce the problem:

  1. Run the cocos2d game
  2. Make a phone call to the phone that running the game
  3. It crashed and show [CDAudioManager handleInterruption]: unrecognized selector sent.

To fix the problem, change the following code in CDAudioManager.m
From:
[[NSNotificationCenter defaultCenter] addObserver: self
selector: NSSelectorFromString(@“handleInterruption”)
name: AVAudioSessionInterruptionNotification
object: [AVAudioSession sharedInstance]];
To:
[[NSNotificationCenter defaultCenter] addObserver: self
selector:@selector(handleInterruption:)
name: AVAudioSessionInterruptionNotification
object: [AVAudioSession sharedInstance]];

3 Likes

Can you create a pull request for that, so the future versions of cocos are fixed by default?

1 Like

Thank you for this! We just released the game update with new cocos2d version and this is only crash we had. Also good adding this to test cases. You saved lots of my time! And yes, your solution works perfectly.

Cheers!

I have the same crash in the 3.16.
Is there an update available ?
Need I rollback to the 3.15 ?
Thanks.

Great sharing.

That was by far the issue most affecting the users of my game (World Soccer Challenge).

In 3.17 this is still NOT fixed.