How to prefetch MPU Banner Ads in UICollectionView [iOS Swift 4.2]

332 views
Skip to first unread message

Muralidharan K

unread,
Jun 28, 2019, 9:05:05 AM6/28/19
to Google Mobile Ads SDK Developers

let bannerView = DFPBannerView(adSize: kGADAdSizeMediumRectangle)


I am using the above ad format in my collection view as one of the cells.

Whenever the user scrolls to the cell the ads load very slow.


I want to prefetch the ad and keep ready when he comes to the cell.


Could you please help me with the flow.


Simulator Screen Shot - iPhone Xʀ - 2019-06-28 at 18.31.16.png


Mobile Ads SDK Forum Advisor Prod

unread,
Jun 28, 2019, 4:17:05 PM6/28/19
to kmurali...@gmail.com, google-adm...@googlegroups.com
Hello there,

We do have a UITableView example using BannerAds. You should certainly be able to reuse this for UICollectionView as well.

Let us know if you need anything else.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
 



ref:_00D1U1174p._5001UCZznw:ref

Muralidharan K

unread,
Jun 30, 2019, 2:24:17 AM6/30/19
to Google Mobile Ads SDK Developers
Hi, I agree and I have already using the reusable identifier. My clarification is: How to prefetch the content and make the cell ready before the scrolls!

So when he comes to that cell by scrolling I should able to show the ad without any delay.

Thanks

Mobile Ads SDK Forum Advisor Prod

unread,
Jul 1, 2019, 3:29:40 PM7/1/19
to kmurali...@gmail.com, google-adm...@googlegroups.com

Hello Murali,

You can always prefetch the ad and hold it onto a dictionary with the IndexPaths as key and either insert the ad if exists or show a request a new one and insert when visible to the user. Exempt the AdView from being reused via prepareForReuse() callback and maintain it outside the purview of the UICollectionViewCell. The sample app provided does guide you on this approach. Let us know if you need anything else



Regards,
Deepika Uragayala
Mobile Ads SDK Team
 



ref:_00D1U1174p._5001UCZznw:ref
Reply all
Reply to author
Forward
0 new messages