Inline Adaptive Ads within UITableView

377 views
Skip to first unread message

Ivan

unread,
Oct 18, 2023, 3:12:17 PM10/18/23
to Google Mobile Ads SDK Developers
Are there any resources I can review working with inline adaptive (variable height) ads within a TableView?  I seem to be running into a chicken and egg scenario where I set up an initial BannerView with a certain size but declare adSize as “Adpative with Max Height = X” however the SDK seems to be using the Banner View frame dimensions instead of the adSize.  This is true whether I use "GADAdSizeBanner" or "GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(320, 400)" With "GADAdSizeBanner" I can at least set up my frame to match ahead of time.  Ideally the SDK would honor the requested ad size instead of the frame size and in the delegate "bannerViewDidReceiveAd" tell me the size of the ad loaded that way I can adjust the size of the containing Banner View.

Mobile Ads SDK Forum Advisor

unread,
Oct 18, 2023, 4:59:42 PM10/18/23
to iva...@outlook.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK support team.

When you create an inline adaptive banner ad, you need to specify the width of the ad and a maximum height. The SDK will then return an AdSize object with the actual height of the ad. However, the SDK does not automatically adjust the frame of the BannerView to match the height of the ad.

To workaround this issue, you need to manually adjust the frame of the BannerView after the ad has loaded. You can do this in the bannerViewDidReceiveAd: delegate method. Here is an example:

func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
// Get the height of the ad.
 let adHeight = bannerView.ad.adSize.height

// Adjust the frame of the BannerView to match the height of the ad. 
bannerView.frame.size.height = adHeight
 }

For more information, please refer the following links:
https://developers.google.com/admob/ios/banner/anchored-adaptive
 

This message is in relation to case "ref:!00D1U01174p.!5004Q02pUL0F:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team

 



Ivan

unread,
Oct 18, 2023, 5:29:24 PM10/18/23
to Google Mobile Ads SDK Developers
This is exactly how I expect it to work and am attempting to do however I can see in the outgoing request it is requesting sz as 393x63 or similar (the actual size of the Banner View frame) instead of what was requested with in the adSize.  The bannerViewDidReceiveAd also reflects this same sz (393x63).  

adSize is requested for instance with GADAdSizeBanner (320x50) and set into this

GAMBannerView(adSize: adSize)

the GAMBannerView at this point in time is 393x63


The outgoing request to the ad server is using 393x63.  The bannerViewDidReceiveAd's bannerView argument does not contain an ad 

'GADBannerView' has no member 'ad'

bannerView.ad.adSize.height


bannerView.adSize reflects 393x63


Mobile Ads SDK Forum Advisor

unread,
Oct 19, 2023, 4:51:45 AM10/19/23
to iva...@outlook.com, google-adm...@googlegroups.com

Hi,

Thank you for getting back to us.

Upon reviewing your concern you are facing an issue with ad requests for Banner view. Kindly share the below information to investigate further.

  • Mobile Ads SDK Version
  • App ID and Ad Unit ID
  • Charles log
  • Code snippet

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002pUL0FQAW&entry.80707362=00205716

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

 

Dhedy 95

unread,
Oct 19, 2023, 7:28:03 AM10/19/23
to Ivan, Google Mobile Ads SDK Developers
ya

Pada tanggal Kam, 19 Okt 2023 03:12, Ivan <iva...@outlook.com> menulis:
Are there any resources I can review working with inline adaptive (variable height) ads within a TableView?  I seem to be running into a chicken and egg scenario where I set up an initial BannerView with a certain size but declare adSize as “Adpative with Max Height = X” however the SDK seems to be using the Banner View frame dimensions instead of the adSize.  This is true whether I use "GADAdSizeBanner" or "GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(320, 400)" With "GADAdSizeBanner" I can at least set up my frame to match ahead of time.  Ideally the SDK would honor the requested ad size instead of the frame size and in the delegate "bannerViewDidReceiveAd" tell me the size of the ad loaded that way I can adjust the size of the containing Banner View.

--

---
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/4c83cec2-a0dd-4078-982a-3a7249b78d59n%40googlegroups.com.

Mobile Ads SDK Forum Advisor

unread,
Oct 19, 2023, 7:44:02 AM10/19/23
to kimoci...@gmail.com, google-adm...@googlegroups.com, iva...@outlook.com

Hi,

Thank you for contacting the Mobile Ads SDK support team. 

Please note that we received only a “ya” message from you. Could you please specify if you are facing any issues related to Google Mobile Ads SDK?

This message is in relation to case "ref:!00D1U01174p.!5004Q02pUWS7:ref"


Thanks,
 
Google Logo Mobile Ads SDK Team


Message has been deleted
Message has been deleted

Ivan

unread,
Oct 19, 2023, 5:27:30 PM10/19/23
to Google Mobile Ads SDK Developers
Here are the code snippets

func setupAd() {
....
    bannerView = GAMBannerView(adSize: GADAdSizeBanner)
    bannerView.translatesAutoresizingMaskIntoConstraints = false
    self.addSubview(bannerView)
    AutoLayout.fill(bannerView, ofAncestor: self)
...
}

func callAd() {
....
        bannerView.adUnitID = "ca-app-pub-3165173928324362/5893339019"
        bannerView.rootViewController = UIApplication.shared.currentWindow?.rootViewController
        bannerView.delegate = self
        bannerView.load(GADRequest())
....
    }


I believe this contains the info regarding app id, ad unit id, sdk version.  Here we see format=393x63 instead of GADAdSizeBanner (320x50)

Also to clarify I have seen the same behavior when attempting to pull a banner from a GAM server vs AdMob.  That's where I saw sz reflect the same size as the frame instead of the requested adSize.

https://googleads.g.doubleclick.net/mads/gma?u_w=393&os_version=16.4.0&ms=11&u_so=p&omid_v=1.4.8-google_20230803&request_origin=resize&submodel=arm64&eid=318502621%2C318500618%2C318494274%2C318508411%2C318511282%2C44766145&net=wi&u_sd=3&js=afma-sdk-i-v10.12.0&fbs_aiid=BDBEA4CECA3E402C9D132A0C6DAEB530&u_h=852&fbs_aeid=-1721938674445031956&guci=0.0.0.0.0.0.0.0&attmas=authorized&adtest=on&sdk_apis=7%2C8&omid_p=Google%2Fafma-sdk-i-v10.12.0&format=393x63_mb&an=0.0.0.iphone.com.mycompany&u_audio=4&swipeable=1&isv=17.0&skan=cstr6suwn9%2C4fzdc2evr5%2C4pfyvq9l8r%2C2fnua5tdw4%2Cydx93a7ass%2C5a6flpkh64%2Cp78axxw29g%2Cv72qych5uu%2Cludvb6z3bs%2Ccp8zw746q7%2C3sh42y64q3%2Cc6k4g5qg8m%2Cs39g8k73mm%2C3qy4746246%2Cf38h382jlk%2Chs6bdukanm%2Cv4nxqhlyqp%2Cwzmmz9fp6w%2Cyclnxrl5pm%2Ct38b2kh725%2C7ug5zh24hu%2Cgta9lk7p23%2Cvutu7akeur%2Cy5ghdn5j9k%2Cn6fk4nfna4%2Cv9wttpbfk9%2Cn38lu8286q%2C47vhws6wlr%2Ckbd757ywx3%2C9t245vhmpl%2Ceh6m2bh4zr%2Ca2p9lx4jpn%2C22mmun2rn5%2C4468km3ulz%2C2u9pt9hc89%2C8s468mfl3y%2Cklf5c3l5u5%2Cppxm28t8ap%2Cecpz2srf59%2Cuw77j35x4d%2Cpwa73g5rt2%2Cmlmmfzh3r3%2C578prtvx9j%2C4dzt52r2t5%2Ce5fvkxwrpn%2C8c4e2ghe7u%2Czq492l623r%2C3rd42ekr43%2C3qcr597p9d&loeid=44766145&preqs=1&seq_num=2&time_in_session=0&preqs_in_session=1&pcc=0&sst=1697747760000&output=html&region=mobile_app&u_tz=-420&client=ca-app-pub-3165173928324362&slotname=5893339019&hl=en&gsb=wi&apm_app_id=1%3A386042279684%3Aios%3A56d601e41f798c00&gmp_app_id=1%3A386042279684%3Aios%3A56d601e41f798c00&apm_app_type=1&app_wp_code=ca-app-pub-3165173928324362&app_code=1403375767&caps=interactiveVideo_inlineVideo_mraid1_mraid2_mraid3_th_autoplay_mediation_av_sdkAdmobApiForAds_di_transparentBackground_sdkVideo_aso_sfv_dinm_dim_nav_navc_ct_scroll_dinmo_gls_saiMacro_omidEnabled_gcache_aboi_xSeconds&paidl=36&paidv1_tsl=-1&paid2l=36&session_idl=20&vid1l=36&vid2l=36&rdidl=36&idtypel=4&blob=ABPQqLFrhkqaB1Z6-uZRKqbv7cWgcaqTX-EctiYJvLdHcu13_ExpBZGeL54OCxFxLRf3PP2d1IN1zst34CYPg5TczF-kftA8PspPsEB3M7SQ7UVqDWZ_75J4_JwtT5pqWN3xmfUBySuSl1IS7A2iMoqbRas5qeyYotoOze83ELWMQJQB0gAx3vTb8LPv2Zg8pRpIpCCSoDpFQgzMjoGV9Ca51abAq0UunecWqkccVnpqiZysX3H02gDs054TQh_bQ5IiIVQnbVgLsx-si7UAKkUQGRURlPWmHfNQhYFC6R3FgbZnM6p-SQKw2-Ngw61SrEnGdnKBd-9eaoN2S2rScxX3D4FkUwVihMbIoW_rSNJmszxa5hiwyHMOgjrmjI3RftQrZxUZ8x7v2rO_zqdtfFB0NudIQklnhDvCrShgdBP4mN81WAQ5TNd-yevPkXU9zuH-bAI3acP_Ue4tnYSYYw8wa48QlNScXROtKNBIckX-OZIxNquMZR3YxSsB820fuYD_9dvy1XoWED16g5bdw3EiQ3SPsEIlbJaLWG3BdGpZTUPHOP5DOp5UIwmh5mPP-FnVLGg8ZS6zW2dLYCMakEssAwx5jAjM5xWOmzax&adk=462819431&jsv=sdk_20231010_RC00#caps=interactiveVideo_inlineVideo_mraid1_mraid2_mraid3_th_autoplay_mediation_av_sdkAdmobApiForAds_di_transparentBackground_sdkVideo_aso_sfv_dinm_dim_nav_navc_ct_scroll_dinmo_gls_saiMacro_omidEnabled_gcache_aboi_xSeconds&eid=318502621%252C318500618%252C318494274%252C318508411%252C318511282%252C44766145&format=393x63_mb&js=afma-sdk-i-v10.12.0&preqs=1&seq_num=2

Mobile Ads SDK Forum Advisor

unread,
Oct 19, 2023, 5:49:54 PM10/19/23
to iva...@outlook.com, google-adm...@googlegroups.com

Hi,

Thank you for getting back to us.

Please note that to create an inline adaptive banner ad size in swift:

let adSize = GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(bannerView.frame.width, 400)

bannerView = GAMBannerView(adSize: adSize)

This will create an inline adaptive banner ad that is up to 400 pixels in height. The actual height of the ad will be determined by the ad network.

Once the ad has loaded, the bannerViewDidReceiveAd: delegate method will be called. In this method, you can get the actual size of the ad using the bannerView.adSize property. You can then use this size to resize the banner view.

For example, the following code would resize the banner view to match the size of the ad:

func bannerViewDidReceiveAd(_ bannerView: GAMBannerView) {

  let adSize = bannerView.adSize

  bannerView.frame = CGRect(x: 0, y: 0, width: adSize.width, height: adSize.height)
}
 

Ivan

unread,
Oct 19, 2023, 5:51:47 PM10/19/23
to Google Mobile Ads SDK Developers
I'm running into an issue and have simplified my first issue to just requesting a static ad size (320x50).  The outgoing request and response are NOT 320x50 and instead both 393x63.

Malek rafee

unread,
Oct 19, 2023, 6:30:08 PM10/19/23
to Dhedy 95, Ivan, Google Mobile Ads SDK Developers
Where do you live? My friends are with you, Malik, from Jordan. I am 23, and what are your ages? 


Ivan

unread,
Oct 23, 2023, 12:25:18 PM10/23/23
to Google Mobile Ads SDK Developers
Hi -

Wondering if there are any updates on this issue?  Specifically the outgoing and incoming ad size being incorrect.

Mobile Ads SDK Forum Advisor

unread,
Oct 23, 2023, 12:55:52 PM10/23/23
to iva...@outlook.com, google-adm...@googlegroups.com

Hi,

Thank you for getting back to us.

Please note that we already requested below information for further investigation.

  • app ID
  • ad Unit ID
  • Mobile Ads SDK Version
  • Charles log
  • Sample project reproducing the issue

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, kindly provide requested information to us via reply privately to author option or using the steps below:

3. Please reply back to this thread when you have uploaded your file(s). Please do not share this link.

This message is in relation to case "ref:!00D1U01174p.!5004Q02pUL0F:ref"


Thanks,
 
Google Logo Mobile Ads SDK Team


Ivan

unread,
Oct 25, 2023, 1:31:46 PM10/25/23
to Google Mobile Ads SDK Developers
Hi - I've sent in my project and details a couple days ago.  I'm wondering if someone has had a chance to review?

Mobile Ads SDK Forum Advisor

unread,
Oct 26, 2023, 10:26:30 AM10/26/23
to iva...@outlook.com, google-adm...@googlegroups.com

Hi Ivan,

Thank you for contacting the Mobile Ads SDK Support team.

Upon checking the ap id and unit id you provided, it appears that the application is for Roku.

According to the Mobile Ads SDK documentation, we support the following platforms: 

Mobile Ads SDK Forum Advisor

unread,
Oct 26, 2023, 10:47:34 AM10/26/23
to iva...@outlook.com, google-adm...@googlegroups.com

Hi Ivan,

Thank you for contacting the Mobile Ads SDK Support team.

Please ignore my previous email. Upon checking the app Id and unit Id you provided, it appears that the application is for Roku.

Reply all
Reply to author
Forward
0 new messages