iOS Bug: Ad callbacks not triggering (reproducible)
See original GitHub issue[REQUIRED] Step 1: Describe your environment
- Unity version: 2021.2.1, 2021.1.1
- Google Mobile Ads Unity plugin version: 6.1.2
- Platform: iOS
- Platform OS version: iOS 15.2, 15.1
- Any specific devices issue occurs on: any iOS device
- Mediation ad networks used, and their versions: none
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
AdMob Event Issue (2021.2.1).zip
- build and run the provided project on iOS
- open the app and wait for AdMob to initialize and load an ad
- press the ‘Show Ad’ button
- press the X button on the interstitial test ad to close it
- immediately open the iOS control center (swipe down from the right side of the top edge of the screen)
Expected result: the ad closes and the OnAdClosed
callback is triggered
Actual result: the ad closes but the OnAdClosed
callback is NOT triggered
Here are two videos:
- the ‘control’: the app can load an ad, open and close it, and all the associated callbacks function properly https://user-images.githubusercontent.com/11318436/146649288-935c6fe7-e4de-421c-b6a2-e5708d9f70a7.mov
- the ‘problem’: demonstrating the bug, folowing steps 2-5 from above https://user-images.githubusercontent.com/11318436/146649321-608ab374-c38b-4b66-a041-af0757dd691e.mov
Notes and findings:
- on iOS, by default, opening the control center (or notifications, or multitasking) will pause the game and make it not in focus (can be seen by using
MonoBehaviour.OnApplicationPause
andMonoBehaviour.OnApplicationFocus
) - by enabling the ‘Enable Custom Background Behaviours’ option (in Player Settings > Other Settings > Configuration), the game won’t be paused when the control center is opened, but it will lose focus (according to the two methods from the previous point); this bug still occurs even with this option enabled
- settings the game to pause while an ad is running with
MobileAds.SetiOSAppPauseOnBackground(true);
does not solve this issue either; the same thing happens and the game remains paused - I don’t know if it is relevant, but this bug occurs with both test ads and real ads (in a launched product)
- the example project uses a bare-bones implementation of AdMob, using the sample code from this repository and the official guide
- I haven’t tested it, but I think this issue happens with reward ads as well (
OnAdClosed
and maybe evenOnUserEarnedReward
with proper timing) - the issue doesn’t seem to occur on Android devices by opening the notifications pull-down menu, might be because that doesn’t pause the game or the ad
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
iOS Bug: Ad callbacks not triggering (reproducible)
iOS Bug : Ad callbacks not triggering (reproducible). 26 views.
Read more >Admob's callback not firing everytime in Swift
I made an app in Swift with SwiftUI framework and SwiftUI App life cycle. ... The problem is that sometime the callback work,...
Read more >Bug - Game may start with incorrect Orientation
We noticed that the bug may not have reproducible on an iPhone 13 with iOS 16.1.2, but it did occur when upgrading that...
Read more >Apple Developer Forums
I am trying to automate Web app on iOS Safari for e2e test. Even though following code worked for emulator in iOS 17...
Read more >Apple Developer Forums
Connect with fellow developers and Apple experts as you give and receive help on a wide variety of development topics, from implementing new...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This problem is still not solved for me too
@PokerDawg I implemented the suggested fix of wrapping the callback handler within
ExecuteInUpdate()
. The result looked correct to me (image below). I will be closing this issue, please feel free to reopen if there is something I missed or you are still stuck.