Crash when showing an AdMob ad. I realise this is probably a Google Ads issue but thought I'd provide insight since we are showing them via UnityMediation now. Code (CSharp): CrashReporter Key: aad8faa2cf7f5af1494e218ca01d937a12a64b7e Hardware Model: iPhone9,4 Process: AliceLegends Identifier: com.bhe.alicelegends Version: 3.3.0 Role: Background OS Version: iOS 15.4.1 Exception Type: EXC_BAD_ACCESS EXC_BAD_ACCESS: Attempted to dereference garbage pointer 0x58. 0 AliceLegends GC_is_marked (mark.c:242:17) 1 AliceLegends GC_finish_collection (alloc.c:1084:7) 2 AliceLegends GC_try_to_collect_inner (alloc.c:592:5) 3 AliceLegends GC_init (misc.c:1323:9) 4 AliceLegends GC_generic_malloc_inner (malloc.c:174:15) 5 gcj_mlc.c GC_gcj_malloc 6 AliceLegends il2cpp::vm::Object::NewAllocSpecific(Il2CppClass*) (Object.cpp:78:9) 7 AliceLegends il2cpp::vm::Thread::Attach(Il2CppDomain*) (Thread.cpp:121:40) 8 AliceLegends il2cpp::vm::ScopedThreadAttacher::ScopedThreadAttacher() (ScopedThreadAttacher.cpp:10:28) 9 AliceLegends ReversePInvokeWrapper_IosRewardedShowListener_Closed_m1E7E7EA93868CF08856059BE30E458569D7B4DAB (Unity.Mediation.cpp:7644:35) 10 AliceLegends -[UMSPRewardedAdShowDelegate onRewardedClosed:] (UMSPRewardedAdShowDelegate.mm:27:9) 11 UnityFramework -[UMSRewardedAd triggerOnRewardedClosed] 12 UnityFramework -[UMSRewardedAd onRewardedAdapterClosed] 13 UnityFramework __36-[UMSAdmobRewardedAd show:delegate:]_block_invoke_2 14 UnityFramework -[UMSAdmobFullScreenContentDelegate adDidDismissFullScreenContent:] 15 UnityFramework GAD_GADRewardedAd_arm64_8_13_0 16 UnityFramework __copy_helper_block_e8_32s40s48s56b64s 17 UnityFramework __copy_helper_block_e8_32s40s48s56b64s 18 UnityFramework GADPostNotification 19 Foundation -[__NSObserver _doit:] 20 CoreFoundation ___CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ 21 CoreFoundation ____CFXRegistrationPost_block_invoke 22 CoreFoundation __CFXRegistrationPost 23 CoreFoundation __CFXNotificationPost 24 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] 25 UnityFramework GADPostNotification 26 UnityFramework GADPostNotification 27 UnityFramework GAD_GADIntermission_arm64_8_13_0 28 UnityFramework GAD_GADIntermission_arm64_8_13_0 29 UnityFramework GAD_GADIntermission_arm64_8_13_0 30 UnityFramework GADPostNotification 31 Foundation -[__NSObserver _doit:] 32 CoreFoundation ___CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ 33 CoreFoundation ____CFXRegistrationPost_block_invoke 34 CoreFoundation __CFXRegistrationPost 35 CoreFoundation __CFXNotificationPost 36 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] 37 UnityFramework GADPostNotification 38 UnityFramework GADPostNotification 39 UnityFramework GAD_GADFullScreenAdViewController_arm64_8_13_0 40 UIKitCore -[UIViewController _setViewAppearState:isAnimating:] 41 UIKitCore -[UIViewController __viewDidDisappear:] 42 UIKitCore -[UIViewController _endAppearanceTransition:] 43 UIKitCore ___48-[UIPresentationController transitionDidFinish:]_block_invoke 44 UIKitCore -[UIPresentationController transitionDidFinish:] 45 UIKitCore -[_UICurrentContextPresentationController transitionDidFinish:] 46 UIKitCore ___56-[UIPresentationController runTransitionForCurrentState]_block_invoke.437 47 UIKitCore -[_UIViewControllerTransitionContext completeTransition:] 48 UIKitCore -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] 49 UIKitCore ____UIViewControllerTransitioningRunCustomTransition_block_invoke_2 50 UIKitCore +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] 51 UIKitCore ____UIViewControllerTransitioningRunCustomTransition_block_invoke.641 52 UIKitCore +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] 53 UIKitCore __UIViewControllerTransitioningRunCustomTransition 54 UIKitCore ___56-[UIPresentationController runTransitionForCurrentState]_block_invoke.401 55 UIKitCore +[UIPresentationController _scheduleTransition:] 56 UIKitCore -[UIPresentationController runTransitionForCurrentState] 57 UIKitCore -[UIPresentationController _dismissWithAnimationController:interactionController:target:didEndSelector:] 58 UIKitCore ___99-[UIViewController _dismissViewControllerWithAnimationController:interactionController:completion:]_block_invoke_2 59 UIKitCore +[UIView(Animation) performWithoutAnimation:] 60 UIKitCore -[UIViewController _dismissViewControllerWithAnimationController:interactionController:completion:] 61 UIKitCore +[UIView(Animation) performWithoutAnimation:] 62 UIKitCore -[UIViewController _dismissViewControllerWithTransition:from:completion:] 63 UIKitCore -[UIViewController dismissViewControllerWithTransition:completion:] 64 UIKitCore -[UIViewController _performCoordinatedPresentOrDismiss:animated:] 65 UIKitCore -[UIViewController dismissViewControllerAnimated:completion:] 66 UIKitCore ___68-[UIWindow _removeAllViewControllersFromWindowHierarchyFromDealloc:]_block_invoke 67 UIKitCore +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] 68 UIKitCore -[UIWindow _removeAllViewControllersFromWindowHierarchyFromDealloc:] 69 UIKitCore -[UIWindow setRootViewController:] 70 AliceLegends UnityCleanupTrampoline (UnityAppController.mm:178:34) 71 AliceLegends -[UnityAppController applicationWillTerminate:] (UnityAppController.mm:518:9) 72 UIKitCore -[UIApplication _terminateWithStatus:] 73 UIKitCore -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] 74 UIKitCore -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] 75 UIKitCore -[UIApplication workspaceShouldExit:withTransitionContext:] 76 FrontBoardServices ___63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 77 FrontBoardServices -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] 78 FrontBoardServices ___63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke 79 libdispatch.dylib __dispatch_client_callout 80 libdispatch.dylib __dispatch_block_invoke_direct$VARIANT$mp 81 FrontBoardServices __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ 82 FrontBoardServices -[FBSSerialQueue _targetQueue_performNextIfPossible] 83 FrontBoardServices -[FBSSerialQueue _performNextFromRunLoopSource] 84 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 85 CoreFoundation ___CFRunLoopDoSource0 86 CoreFoundation ___CFRunLoopDoSources0 87 CoreFoundation ___CFRunLoopRun 88 CoreFoundation _CFRunLoopRunSpecific 89 GraphicsServices _GSEventRunModal 90 UIKitCore -[UIApplication _run] 91 UIKitCore _UIApplicationMain 92 AliceLegends -[UnityFramework runUIApplicationMainWithArgc:argv:] (main.mm:96:5) 93 AliceLegends main (main.mm:26:9)
Hey @mobearhug, Thanks for sharing this. One question, do you have an OnClosed event subscribed to your RewardedAd instance? Would you mind sharing the contents of that if it exists? Are there any other steps you're doing to trigger this behaviour? Is it 100% reproducible for you? So far I haven't been able to reproduce this. Thanks!
I've only observed this on one occurrence so far and it occurred after the app was suspended. Here are the contents of our callback and the delayed method which handles the behaviour. Code (CSharp): private void OnAdClosed(object sender, EventArgs e) { Logger.Debug(nameof(OnAdClosed)); // Delay by a frame because it is possible for OnAdClosed to be called before OnUserEarnedReward void OnAction() { _scheduler.ScheduleFrames(1, OnDelayAdClosed); } OnAction(); } private void OnDelayAdClosed() { if (!_watched) { Assert.IsNotNull(LoadedAd); Skipped?.Invoke(LoadedAd); } else { Watched?.Invoke(LoadedAd); } IsWatching.Value = false; ReloadInternal(LoadedAd); }
Hi @mobearhug, Thank you for sharing this insight. So OnAdClosed is called after the app goes into the background. That is strange. Generally, this event is triggered by a user invoked event, where the close button is clicked. I've tested to see if Admob's rewarded ad triggers this event in the background, but so far I haven't been able to reproduce. I'll let you know if I am able to reproduce. Thanks
Hey @mobearhug, I'll see if I can reproduce that and if I can, I'll let you know. As for the UnityAds rollback, if you remove that XML file, do you still see this issue? You should see UnityAds 4.2.1 installed at that point. Thank you for sharing this issue! Best regards,