Cocos2d-x 3.16 critical bug with audio manager

Cocos2d-x 3.16 critical bug with audio manager
0.0 0


@nite @slackmoehrle

I think there is critical bug with audio manager in cocos2d-x 3.16 , it crashing app on IOS 11 time to time.

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x185a81d04 __exceptionPreprocess
1  libobjc.A.dylib                0x184cd0528 objc_exception_throw
2  CoreFoundation                 0x185a8f1c8 __methodDescriptionForSelector
3  CoreFoundation                 0x185a876b0 ___forwarding___
4  CoreFoundation                 0x18596d01c _CF_forwarding_prep_0
5  CoreFoundation                 0x185a140bc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
6  CoreFoundation                 0x185a1365c _CFXRegistrationPost
7  CoreFoundation                 0x185a133c0 ___CFXNotificationPost_block_invoke
8  CoreFoundation                 0x185a909c4 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
9  CoreFoundation                 0x18594a0c0 _CFXNotificationPost
10 Foundation                     0x18636b498 -[NSNotificationCenter postNotificationName:object:userInfo:]
11 AVFAudio                       0x18b23a044 -[AVAudioSession privateInterruptionWithInfo:]
12 AVFAudio                       0x18b23b054 (anonymous namespace)::HandlePropertyListenerCallback(unsigned int, objc_selector*, NSObject*)
13 libdispatch.dylib              0x185405088 _dispatch_call_block_and_release
14 libdispatch.dylib              0x185405048 _dispatch_client_callout
15 libdispatch.dylib              0x185411b74 _dispatch_main_queue_callback_4CF$VARIANT$mp
16 CoreFoundation                 0x185a29eb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
17 CoreFoundation                 0x185a27a8c __CFRunLoopRun
18 CoreFoundation                 0x185947fb8 CFRunLoopRunSpecific
19 GraphicsServices               0x1877dff84 GSEventRunModal
20 UIKit                          0x18ef1c2f4 UIApplicationMain
21 Mygame-mobile              0x100d010f8 main (main.m:5)
22 libdyld.dylib                  0x18546a56c start


Can you share any more info? I can ask Engineering to take a look.


Hi, unfortionatly we don’t have much only that crash log, we released our game with cocos2d-x 3.16 and app started to crash to a lot of users, like there was refresh on banner, then sound dissapear and after few seconds app crashing. After replacing cocos with 3.14 everything went to normal no such crashes anymore.

From log we blaming audio, but maybe there is something else which not working properly on IOS11, for Android same code was working fine.


I’ll add engineering team staff to the PM you sent!


Any news on this? I also get a lot of crash reports about this.


I think there was a reply in GitHub about this and it turned out to be some other issue. Ill check


I couldn’t find anything on GitHub.

Cocos2d-x Android long compile (seems console bug)

I have this problem too (iPhone 5s, cocos2d-x 3.16). I think it’s because of an apple bug, but the question is if they will ever solve this. Anyone knows how to prevent this crash?
It looks like it is linked to this:

According to this article it can be solved by
[[AVAudioSession sharedInstance] setDelegate: nil];
[[AVAudioSession sharedInstance] setDelegate: self];
But there is no code that matches to replace in cocos2d-x