googleads-mobile-unity: Frequent NSInternalInconsistencyException Crashes After Displaying Full-Screen Ads
[REQUIRED] Step 1: Describe your environment
- Unity version: 2022.3.22f1
- Google Mobile Ads Unity plugin version: v9.5.0
- Plugin installation method: unitypackage import
- Platform: iOS
- Platform OS version: iOS 18
- Any specific devices issue occurs on: iPhone13, 15, 16, 16 pro
- Mediation ad networks used, and their versions: Liftoff Monetize 5.2.3, Pangle 4.5.4
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
We do not have a reliable step-by-step reproduction procedure. However, Crashlytics frequently reports the following crash after users have viewed a full-screen ad. It appears to occur around the time the ad is dismissed.
The crash does not happen for every ad impression, and we haven’t been able to reproduce it reliably in our own testing. We do not call Application.Quit() or exit(0) anywhere in our code.
Below is a snippet of the crash log:
Fatal Exception: NSInternalInconsistencyException
Attempting to attach window to an invalidated scene: <UIWindowScene: 0x1028a3380; role: UIWindowSceneSessionRoleApplication; persistentIdentifier: 805D79E0-CA08-4454-9964-375E03A9C791; activationState: UISceneActivationStateUnattached>; window: <ASOOverlayWindow: 0x138ae8000; baseClass = UIApplicationRotationFollowingWindow; frame = (0 0; 390 844); hidden = YES; layer = <UIWindowLayer: 0x3034f4c30>>
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x827cc __exceptionPreprocess
1 libobjc.A.dylib 0x172e4 objc_exception_throw
2 Foundation 0x80f8d8 _userInfoForFileAndLine
3 UIKitCore 0x362958 -[UIWindowScene _attachWindow:]
4 UIKitCore 0x3625b4 -[UIWindow _commonInitDebugName:uiScene:]
5 UIKitCore 0x3624a0 -[UIWindow _initWithFrame:debugName:windowScene:]
6 UIKitCore 0x2ccaf0 -[UIApplicationRotationFollowingWindow _initWithFrame:debugName:windowScene:]
7 UIKitCore 0x2cc8e4 -[UIWindow initWithWindowScene:]
8 UIKitCore 0xd1a34c -[UIApplicationRotationFollowingWindow initWithWindowScene:]
9 AppStoreOverlays 0x5778 -[ASOOverlayWindow initWithWindowScene:]
10 AppStoreOverlays 0x302c -[ASOOverlayManager initWithWindowScene:]
11 AppStoreOverlays 0x37e0 -[UIWindowScene(AppOverlayManager) _aso_appOverlayManager]
12 StoreKit 0x45fd8 +[SKOverlay dismissOverlayInScene:]
13 UnityFramework 0x247c22c GAD_GADInAppStoreMonitor_arm64_11_7_0
14 UnityFramework 0x24c0ba0 GADPostNotificationFromMainQueue
15 CoreFoundation 0x512e0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
16 CoreFoundation 0x51210 ___CFXRegistrationPost_block_invoke
17 CoreFoundation 0x51158 _CFXRegistrationPost
18 CoreFoundation 0x4f70c _CFXNotificationPost
19 Foundation 0x2fea4 -[NSNotificationCenter postNotificationName:object:userInfo:]
20 UnityFramework 0x24c06c0 GADPostNotificationFromMainQueue
21 UnityFramework 0x24bfba8 GADPostNotification
22 UnityFramework 0x246cfb8 GAD_GADIntermission_arm64_11_7_0
23 UnityFramework 0x246cdf4 GAD_GADIntermission_arm64_11_7_0
24 UnityFramework 0x246ce58 GAD_GADIntermission_arm64_11_7_0
25 UnityFramework 0x246c5bc GAD_GADIntermission_arm64_11_7_0
26 UnityFramework 0x24c0ba0 GADPostNotificationFromMainQueue
27 CoreFoundation 0x512e0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
28 CoreFoundation 0x51210 ___CFXRegistrationPost_block_invoke
29 CoreFoundation 0x51158 _CFXRegistrationPost
30 CoreFoundation 0x4f70c _CFXNotificationPost
31 Foundation 0x2fea4 -[NSNotificationCenter postNotificationName:object:userInfo:]
32 UnityFramework 0x24c06c0 GADPostNotificationFromMainQueue
33 UnityFramework 0x24bfba8 GADPostNotification
34 UnityFramework 0x244d488 GAD_GADFullScreenAdViewController_arm64_11_7_0
35 UIKitCore 0xe4290 -[UIViewController _setViewAppearState:isAnimating:]
36 UIKitCore 0x2faa2c -[UIViewController __viewDidDisappear:]
37 UIKitCore 0x2fa6e0 -[UIViewController _endAppearanceTransition:]
38 UIKitCore 0x2e47b4 __48-[UIPresentationController transitionDidFinish:]_block_invoke
39 UIKitCore 0x28ccb0 -[UIPresentationController transitionDidFinish:]
40 UIKitCore 0xa6a3b4 -[_UICurrentContextPresentationController transitionDidFinish:]
41 UIKitCore 0xa67c20 __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke.112
42 UIKitCore 0x2e3194 -[_UIViewControllerTransitionContext completeTransition:]
43 UIKitCore 0x2e54c8 -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:]
44 UIKitCore 0xb1cd50 ___UIViewControllerTransitioningRunCustomTransitionWithRequest_block_invoke_3
45 UIKitCore 0x43343c +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:]
46 UIKitCore 0xb1cc6c ___UIViewControllerTransitioningRunCustomTransitionWithRequest_block_invoke_2
47 UIKitCore 0x156e694 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:animated:]
48 UIKitCore 0xb1cac0 _UIViewControllerTransitioningRunCustomTransitionWithRequest
49 UIKitCore 0xa676c8 __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke_3
50 UIKitCore 0x28f74c +[UIPresentationController _scheduleTransition:]
51 UIKitCore 0xa66d18 -[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]
52 UIKitCore 0xa65248 -[UIPresentationController _dismissWithAnimationController:interactionController:animated:handoffData:]
53 UIKitCore 0x7ff30 +[UIView(Animation) performWithoutAnimation:]
54 UIKitCore 0xb0e81c __73-[UIViewController _dismissViewControllerWithTransition:from:completion:]_block_invoke
55 UIKitCore 0x7ff30 +[UIView(Animation) performWithoutAnimation:]
56 UIKitCore 0xb0dd74 -[UIViewController _dismissViewControllerWithTransition:from:completion:]
57 UIKitCore 0x525b84 -[UIViewController dismissViewControllerWithTransition:completion:]
58 UIKitCore 0x525248 -[UIViewController _performCoordinatedPresentOrDismiss:animated:]
59 UIKitCore 0x525008 -[UIViewController dismissViewControllerAnimated:completion:]
60 UIKitCore 0x38c144 __68-[UIWindow _removeAllViewControllersFromWindowHierarchyFromDealloc:]_block_invoke
61 UIKitCore 0x38c0ac +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:]
62 UIKitCore 0x38bdc4 -[UIWindow _removeAllViewControllersFromWindowHierarchyFromDealloc:]
63 UIKitCore 0x2150d0 -[UIWindow setRootViewController:]
64 UnityFramework 0x217d0b8 UnityCleanupTrampoline + 172 (UnityAppController.mm:172)
65 UIKitCore 0x113fdcc -[UIApplication _terminateWithStatus:]
66 UIKitCore 0x17ef88 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
67 UIKitCore 0x95f8f4 -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:]
68 UIKitCore 0x113b54c -[UIApplication workspaceShouldExit:withTransitionContext:]
69 FrontBoardServices 0x54f68 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2
70 FrontBoardServices 0x14c44 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
71 FrontBoardServices 0x54f08 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke
72 libdispatch.dylib 0x40d0 _dispatch_client_callout
73 libdispatch.dylib 0x7b14 _dispatch_block_invoke_direct
74 FrontBoardServices 0x16300 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
75 FrontBoardServices 0x16280 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible]
76 FrontBoardServices 0x16158 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource]
77 CoreFoundation 0x56328 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
78 CoreFoundation 0x562bc __CFRunLoopDoSource0
79 CoreFoundation 0x53e24 __CFRunLoopDoSources0
80 CoreFoundation 0x52fbc __CFRunLoopRun
81 CoreFoundation 0x52830 CFRunLoopRunSpecific
82 GraphicsServices 0x11c4 GSEventRunModal
83 UIKitCore 0x3d2eb0 -[UIApplication _run]
84 UIKitCore 0x4815b4 UIApplicationMain
85 UnityFramework 0x2181a48 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 96 (main.mm:96)
86 MyDog 0x412c main + 28 (main.mm:28)
87 ??? 0x1bf152ec8 (シンボルが不足しています)
If there is any known issue or recommended workaround regarding this crash, we would appreciate any guidance. Thank you!
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 34 (2 by maintainers)
We don’t believe this is particularly on ad show. Presence of ASOOverlayWindow makes us think its much later in the cycle. Internally we have seen this issue occur only on iPhones running iOS18 using Unity to build apps. For some context, the admob unity plugin uses the admob ios SDK to show ads and we havent seen similar issues on native iOS Apps. We have added some code to mitigate such crashes in the 12.3 iOS release which will be picked up the upcoming GMA Unity Plugin in the next 10.1 release which should be out later this week/early the week after.
I checked with our iOS team and they said they have added additional checks to try to mitigate this. Unfortunately it doesn’t look like we can fix this properly on our end as such. Even the fix suggested by @bigstupidx exists in code that is beyond the GoogleMobileAds purview. Please try with 10.1.0 update and hopefully it reduces the crash rates.
Online 3 days so far, this bug is gone , and no other unintended issues found yet. crash-free rate increase from 98.5% to 99.8%
Hello, while we were unable to reproduce this exact behavior, we have included some code that might be able to mitigate the crashes in the latest 10.0.0 build. Is it possible for folks to upgrade to the latest and see if they notice a drop in crash rates.
Thanks for the update, I will let the team know.