Xcode: Method called om main thread causing unresponsiveness

5,534 views
Skip to first unread message

Tore Bergethon Østensen

unread,
Aug 25, 2022, 10:33:41 AM8/25/22
to Google Mobile Ads SDK Developers
I'm running Xcode 14 beta 5 with Google Mobile ads 9.9.0, and I'm testing with an iPhone simulator.

After calling GADMobileAds.sharedInstance().start(), Xcode issues a run-time warning: "This method should not be called on the main thread as it may lead to UI unresponsiveness."
I have isolated the issue to exactly this call. It is a simple app just showing a banner ad on top of a selected image. When commenting ut the call, no warning is issued.

Mobile Ads SDK Forum Advisor

unread,
Aug 25, 2022, 3:13:31 PM8/25/22
to to...@ostensen.net, google-adm...@googlegroups.com
Hi Tore,

Thank you for reaching out to us.

I went ahead and check our banner sample app. As per testing, I didn't encounter the reported issue on my end. With this, could you please try our sample app, then let me know how it goes?

Regards,
Google Logo
Teejay Wennie
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2dnZmN:ref

Casey E

unread,
Aug 26, 2022, 12:14:25 AM8/26/22
to Google Mobile Ads SDK Developers

Seeing the same thing with Xcode 14 Beta 6. I ran the BannerExample xcode project from the link you provided and also see the issue there. See screenshot for reference. For me, removing the lines to load the banner ad with a GADRequest along with removing the 

GADMobileAds.sharedInstance().start(completionHandler: nil) removes the warning (basically removing any code that has to do with GADMobileAds).
Screen Shot 2022-08-26 at 12.06.28 AM.png

Tore Bergethon Østensen

unread,
Aug 26, 2022, 5:37:53 AM8/26/22
to Google Mobile Ads SDK Developers
I have tried the sample app, and when I run the iOS simulator for iOS 16, I get the same warning, see the attached image.
Running the app with the iOS 15.5 simulator produces no such warnings. 

Skjermbilde 2022-08-26 kl. 11.35.06.png

Tore Bergethon Østensen

unread,
Aug 26, 2022, 6:04:44 AM8/26/22
to Google Mobile Ads SDK Developers
I have now uploaded a sample project where the warning occurs.

Mobile Ads SDK Forum Advisor

unread,
Aug 26, 2022, 9:01:37 AM8/26/22
to to...@ostensen.net, google-adm...@googlegroups.com
Hi Tore,

Thank you for getting back to us.

I've tested once again the reported behavior with the same environment version that you mentioned and I can now reproduce it on my end. With that, I'll be sharing this to the rest of the team for further investigation. I'll update this thread the soonest the team share their feedback.

Mobile Ads SDK Forum Advisor

unread,
Aug 31, 2022, 2:50:10 AM8/31/22
to to...@ostensen.net, google-adm...@googlegroups.com

Hi All,

I hope you're doing well.

I just want to circle back on this. The team mentioned that this is a bug with Xcode 14 beta 6 / WebKit and that Apple will need to fix it.

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2dnZmN:ref

pengxidi

unread,
Oct 28, 2022, 6:40:20 AM10/28/22
to Google Mobile Ads SDK Developers

Hope admob to fix it, tks

pengxidi

unread,
Oct 28, 2022, 6:41:09 AM10/28/22
to Google Mobile Ads SDK Developers

If you find the issue is pointing at an Apple framework, please use Feedback Assistant to open a bug report to let us know, and include the complete backtrace shown in the issue navigator. You can post the FB numbers to this thread for visibility. Further, if you can't identify where the issue is coming from, as the backtrace points to your main function, please also let us know, including the provided backtrace.

If you find the runtime issue is resulting from an Apple API call used in a sub-optimal way within a third-party library that your app uses, please open a bug report with the library vendor.

在2022年8月31日星期三 UTC+8 14:50:10<mobileadssdk> 写道:

Mobile Ads SDK Forum Advisor

unread,
Oct 28, 2022, 2:41:51 PM10/28/22
to xidi...@gmail.com, google-adm...@googlegroups.com
Hi PXD,

Thank you for pointing this us. Our team already filed a report to Apple, and we're tracking it internally as well. The team mentioned that the warning message should just be ignored in the meantime. You may also keep an eye on our release notes or blog for future updates regarding this.

Regards,
Google Logo
Teejay Wennie
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2dnZmN:ref

Pete

unread,
Jan 20, 2023, 3:01:44 AM1/20/23
to Google Mobile Ads SDK Developers
Unfortunately the issue is still occurring in Xcode 14.1.
Any information on when this will be resolved? Will Apple approve my app with this failure message showing up or do I need to remove the banner ad?

Mobile Ads SDK Forum Advisor

unread,
Jan 20, 2023, 12:01:52 PM1/20/23
to pmgr...@gmail.com, google-adm...@googlegroups.com
Hi Pete,

I'm afraid that the bug on the Apple side is still open. As mentioned by the team, the warning message should just be ignored in the meantime so it's fine to submit your app to AppStore. However, please do let us know if your app got rejected due to the warning log, so I could raise this to the team.

Dimezis

unread,
Feb 26, 2023, 5:37:00 AM2/26/23
to Google Mobile Ads SDK Developers
I really don't think this bug is on the Apple side.
This prints ~10-15ms on average on iPhone 13 Pro.
It might be even worse I guess, because we don't know what's exactly causing it (some IO, parsing, locks?).
Weaker devices might do much worse than iPhone 13 Pro.

let start = Int64((Date().timeIntervalSince1970 * 1000).rounded())
GADMobileAds.sharedInstance().start(completionHandler: nil)
let end = Int64((Date().timeIntervalSince1970 * 1000).rounded())
print("GADMobileAds.sharedInstance().start(completionHandler: nil) took \(end - start) ms")

Walid Malki

unread,
Feb 26, 2023, 12:37:01 PM2/26/23
to Dimezis, Google Mobile Ads SDK Developers
What's the point 

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/b0a00ea3-44f8-4be3-9849-db2aa86ff4e0n%40googlegroups.com.

Mobile Ads SDK Forum Advisor

unread,
Feb 27, 2023, 2:04:39 AM2/27/23
to dmitry...@gmail.com, google-adm...@googlegroups.com
Hi Dimezis,


This function is necessary for initialization. The startWithCompletionHandler: method on the GADMobileAds.sharedInstance, which initializes the SDK and calls back a completion handler once initialization is complete (or after a 30-second timeout). This only needs to be done once, ideally at app launch. If this causes the warnings that were discussed on this thread, it should just be ignored.


Regards,
Google Logo Mobile Ads SDK Team


ref:_00D1U1174p._5004Q2dnZmN:ref

Mobile Ads SDK Forum Advisor

unread,
Feb 27, 2023, 2:06:25 AM2/27/23
to wali...@gmail.com, dmitry...@gmail.com, google-adm...@googlegroups.com
Hello Walid,

Do you have any concerns related to Google Mobile Ads SDK? Feel free to reach out to us.

Regards,
Google Logo Mobile Ads SDK Team


ref:_00D1U1174p._5004Q2dnZmN:ref

neobie

unread,
Feb 28, 2023, 9:45:23 AM2/28/23
to Google Mobile Ads SDK Developers
xcode 14.2, admob v10.1.0
Problem still exists.

Mobile Ads SDK Forum Advisor

unread,
Feb 28, 2023, 2:34:33 PM2/28/23
to kaiya...@gmail.com, google-adm...@googlegroups.com

Hi Neobie,



Thank you for reaching out to us.

As mentioned previously on this thread, I'm afraid that the bug on the Apple side is still open. As mentioned by our team, the warning message should just be ignored in the meantime so it's fine to submit your app to AppStore. However, please do let us know if your app got rejected due to the warning log, so I could raise this to the team. You may also keep an eye on our release notes or blog for future updates regarding this.

Regards,

zaragoza

unread,
Mar 29, 2023, 4:03:15 PM3/29/23
to Google Mobile Ads SDK Developers
I think what Dimezis is asking is if the call:

GADMobileAds.sharedInstance().start(completionHandler: nil)

Is all CPU, or might it block on something or other?

The speculation being that it might be blocking, and changes were introduced into xcode to try and "catch" these blocking calls and warn about them.

Mobile Ads SDK Forum Advisor

unread,
Mar 30, 2023, 3:44:23 AM3/30/23
to zara...@gmail.com, google-adm...@googlegroups.com
Hello Zaragoza,

As stated before on this thread, I'm afraid we're unable to provide information on this as the bug is on Apple's side. As mentioned by our team, the warning message should just be ignored for the time being. However, if you have any further concerns regarding Mobile Ads SDK, feel free to reach out to us.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages