SDKBox Play crash when backgrounding app (iOS13)

SDKBox Play crash when backgrounding app (iOS13)

We’re seeing a fairly regular crash exclusive to iOS 13 which is reproduceable as follows

  • Launch app (iOS)
  • background app before the ‘welcome back x’ game center banner shows
  • return to app
  • observe that app has crashed

While it is not a critical issue, it does skew analytics as a large amount of users are triggering the crash and we hope it can be fixed soon. The issue appears to lie in

-[GKNotificationBannerViewController supportedInterfaceOrientations]

with the following stack trace

*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array

Fatal Exception: NSRangeException
0  CoreFoundation                 0x1a271898c __exceptionPreprocess
1  libobjc.A.dylib                0x1a24410a4 objc_exception_throw
2  CoreFoundation                 0x1a276e3f8 -[__NSCFString characterAtIndex:].cold.1
3  CoreFoundation                 0x1a2602c6c -[__NSArrayM objectAtIndexedSubscript:]
4  GameCenterUI                   0x1c25192e0 -[GKNotificationBannerViewController supportedInterfaceOrientations]
5  UIKitCore                      0x1a6133810 -[UIViewController __supportedInterfaceOrientations]
6  UIKitCore                      0x1a6124c40 -[UIViewController _preferredInterfaceOrientationGivenStatusBarAndDeviceAndOrientation:]
7  UIKitCore                      0x1a67650e8 -[UIWindow _updateToInterfaceOrientation:duration:force:]
8  CoreFoundation                 0x1a267409c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
9  CoreFoundation                 0x1a26740e4 ___CFXRegistrationPost1_block_invoke
10 CoreFoundation                 0x1a2673444 _CFXRegistrationPost1
11 CoreFoundation                 0x1a26730fc ___CFXNotificationPost_block_invoke
12 CoreFoundation                 0x1a25ef43c -[_CFXNotificationRegistrar find:object:observer:enumerator:]
13 CoreFoundation                 0x1a2672a4c _CFXNotificationPost
14 Foundation                     0x1a29cf2d8 -[NSNotificationCenter postNotificationName:object:userInfo:]
15 UIKitCore                      0x1a671ba54 -[UIApplication _stopDeactivatingForReason:]
16 UIKitCore                      0x1a5f00ddc -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
17 UIKitCore                      0x1a5f01124 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
18 UIKitCore                      0x1a5f009e0 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
19 UIKitCore                      0x1a5d75610 -[UIScene _invalidate]
20 UIKitCore                      0x1a694eec4 -[UIWindowScene _invalidate]
21 UIKitCore                      0x1a6722b20 -[UIApplication workspace:willDestroyScene:withTransitionContext:completion:]
22 UIKitCore                      0x1a62e4c10 -[UIApplicationSceneClientAgent scene:willInvalidateWithEvent:completion:]
23 FrontBoardServices             0x1a77b1bdc -[FBSSceneImpl _callOutQueue_agent_willDestroyWithTransitionContext:completion:]
24 FrontBoardServices             0x1a77d7b70 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke_2
25 FrontBoardServices             0x1a77bc0f8 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
26 FrontBoardServices             0x1a77d79e8 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke
27 libdispatch.dylib              0x1a23e6184 _dispatch_client_callout
28 libdispatch.dylib              0x1a238f038 _dispatch_block_invoke_direct$VARIANT$mp
29 FrontBoardServices             0x1a77fb540 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
30 FrontBoardServices             0x1a77fb20c -[FBSSerialQueue _queue_performNextIfPossible]
31 FrontBoardServices             0x1a77fb734 -[FBSSerialQueue _performNextFromRunLoopSource]
32 CoreFoundation                 0x1a26967e0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
33 CoreFoundation                 0x1a2696738 __CFRunLoopDoSource0
34 CoreFoundation                 0x1a2695ed0 __CFRunLoopDoSources0
35 CoreFoundation                 0x1a269101c __CFRunLoopRun
36 CoreFoundation                 0x1a26908bc CFRunLoopRunSpecific
37 GraphicsServices               0x1ac4fc328 GSEventRunModal
38 UIKitCore                      0x1a67266d4 UIApplicationMain
39 __appname__                     0x102144c28 main + 6 (main.m:6)
40 libdyld.dylib                  0x1a251b460 start

Thanks for your feedback.
I’ll try to reproduce this issue with your steps.

Hi @yinjimmy , any luck reproducing the issue?

iphone 6s / iOS 13.1.2
cocos2d-x 3.8.1
xcode 11.1

  1. launch app with Xcode
  2. click connect and background app
  3. click app icon to launch app

no crash.

Have you tested with an app that has already connected to game center? You need to background it before the ‘welcome back’ banner displays.
The steps you listed sounds like a first launch.

yes, I have.

Happens a lot, but not sdkbox related, it crashes for me but i use own GameCenter implementation.

Hi all!

@Guykun are there any successes with fixing this?

We haven’t looked into it further, it’s a fairly harmless crash however it does hurt analytics.
Seems like it’s spreading across games in general, maybe it’s an iOS13 bug?

Let’s keep this thread open as it’s a good Google result for anyone with more information.

@Guykun Thanks for the answer! Yep I think it’s 90% can be iOS13 bug, let’s wait for good wind