AdChoices does not show up in view hierarchy using SwiftUI

437 views
Skip to first unread message

Sebastian

unread,
Jun 9, 2020, 3:47:47 PM6/9/20
to Google Mobile Ads SDK Developers
I'm trying to integrate Unified Native Ads into my SwiftUI-based app, and for some reason am having trouble getting the "AdChoices" icon to show up. The view (GADNativeAdAttributionView) simply does not exist in the view hierarchy. I based the native ad view on a sample app I found on Google's GitHub page, and adapted it for SwiftUI.

I attached a file that contains the code for loading and showing the ad - putting it into a basic SwiftUI app inside the Content View should show the problem. You can see that nowhere do I remove subviews, as far as I can see.
I also attached a screenshot of my app's view hierarchy showing that the GADNativeAdAttributionView is completely missing, and another screenshot of the sample app, which includes the GADNativeAdAttributionView. It's the view at the very end of the list of sub views of GADUnifiedNativeAdView, which makes sense to keep it at the top.
In case of confusion: GADNativeAdAttributionView is misleadingly named, as "attribution" is something different in the Google AdMob documentation - but it is definitely the view that contains the AdChoices icon.

Further details:
Google AdMob SDK: v7.58.0 (via Cocoapods)
XCode: v11.5
I'm reproduced this issue both on an iPhone X (iOS 13.4.1) and the XCode Simulator for iPhone 11 Pro Max (iOS 13.5).

Screenshot 2020-06-09 at 20.29.58.png
Screenshot 2020-06-09 at 20.40.02.png
admob-demo.swift
Message has been deleted

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 9, 2020, 5:55:07 PM6/9/20
to sebasti...@gmail.com, google-adm...@googlegroups.com
Hi Sebastian,

Thank you for bringing up SwiftUI implementation issues with Native Advanced to us. In order for us to look into this further could you zip up a complete and compilable SwiftUI project demonstrating your issue?

Kind regards,
Aryeh Baker
Mobile Ads SDK Team

ref:_00D1U1174p._5004Q20XYyi:ref

Sebastian

unread,
Jun 10, 2020, 4:06:31 AM6/10/20
to Google Mobile Ads SDK Developers
Attached - it's based on Cocoapods, so you'll have to run the "pod install" command when inside the directory, but I tested it, and it should run.

Thanks,
Sebastian
AdMobTest.zip

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 10, 2020, 6:22:59 AM6/10/20
to sebasti...@gmail.com, google-adm...@googlegroups.com
Hi Sebastian,

I work along with Aryeh. Thank you for getting back to us.

As per checking, I could see that you've build your app via SwiftUI. Please note that this support forum is for us to assists you with regard to the code implementation of the Mobile Ads SDK using the following platforms (Android, iOS, Unity, Cocos2d-x). I'm afraid that we don't have the visibility on how the AdMob SDK is implemented on SwiftUI and can't assure you that its feature will work as expected.

Currently, our team is doing a sample app that would work on this. You may want to keep an eye to our blog regarding this. Having said that, we recommend that you reach out to the SwiftUI team for better assistance on this.

As an aside, I have to remove your post as the project you've shared contains a sensitive information like Ad Unit ID. Moving forward, if you want to share anything with us, you can use the "Reply Privately to Author" option to share the details privately.

Regards,
Teejay Pimentel
Reply all
Reply to author
Forward
0 new messages