Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequent NSInternalInconsistencyException Crashes After Displaying Full-Screen Ads #3722

Open
shibatom opened this issue Feb 5, 2025 · 5 comments
Assignees
Labels
Mediation Mediation / adapter issue. P1 Priority issue.

Comments

@shibatom
Copy link

shibatom commented Feb 5, 2025

[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!

@calumma-robert
Copy link

calumma-robert commented Feb 6, 2025

We have the exact same issue!
(AdMob 9.5.0 with LiftOff 5.2.2)
It started 6 days ago (when we basically updated AdMob + Mediators).

We could identify that it seems to be related to Vungle (Liftoff) Interstitial ads, as when we disabled them, the crashes went down. Not sure if also rewarded ads are problematic, but atleast interstitials of them are defintively breaking. Also Vungle seems sometimes on iOS to play sound even so the phone is muted :)

Just checked:
Funny thing we only updated AdMob...as our vungle adapter was manually imported into the project and not via the UPM). Therefore our liftoff adapter is still at 5.2.2

@NVentimiglia
Copy link
Member

Thanks for the report, I will let the IOS team know about this.

So to confirm, the replication steps seem to be:

  • Admob 9.5.0 with the above mediation adapters.
  • "Disable" the interstitial ads (what do you mean by this?)
  • Open the ad?

Corect?

@NVentimiglia NVentimiglia self-assigned this Feb 6, 2025
@NVentimiglia NVentimiglia added P1 Priority issue. Mediation Mediation / adapter issue. labels Feb 6, 2025
@shibatom
Copy link
Author

shibatom commented Feb 7, 2025

@NVentimiglia

Thanks for following up! I’d like to clarify my own situation.

  • AdMob version & mediation: I’m currently using AdMob 9.5.0 with Liftoff, Pangle mediation.

  • Crash details: Crashlytics reports NSInternalInconsistencyException involving [SKOverlay dismissOverlayInScene:]. It usually occurs when a full-screen ad is dismissed or when the app terminates. We’re not calling Application.Quit() or exit(0), and so far we haven’t found a reliable way to reproduce it ourselves. You can see the full crash log snippet in my original post.

  • Regarding “disable the interstitial ads”: Another user mentioned that turning off LiftOff interstitials helped in their case. However, my crashes occur under normal usage, with all interstitial and rewarded ads still enabled.

If there’s a known workaround or any suggestions you can provide, I’d really appreciate it. Thank you for looking into this and for passing the info along to the iOS team!

@calumma-robert
Copy link

Thanks for the report, I will let the IOS team know about this.

So to confirm, the replication steps seem to be:

  • Admob 9.5.0 with the above mediation adapters.
  • "Disable" the interstitial ads (what do you mean by this?)
  • Open the ad?

Corect?

No :)

To replicate the issue you need Admob 9.5.0 + Liftoff mediation adapter.

Disabling liftoff ads (on the admob platform) for interstitials helped us to REDUCE the errors (basically confirming for us, that liftoff ads are the problem). So if you want to see crashes, you need to have liftoff ads of course enabled.

@NVentimiglia
Copy link
Member

Thanks for the update, I will let the team know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mediation Mediation / adapter issue. P1 Priority issue.
Projects
None yet
Development

No branches or pull requests

3 participants