Admob Native Expess Ads blocks while scrolling in UICollectionView

I currently have an AdMob Native Express Ad (GADNativeExpressAdView) configured in a UICollectionViewCell.

  • I used the storyboard to customize it by adding an empty view and assigning it a class GADNativeExpressAdView.
  • Everything loads fine, and an ad appears every 10 cells, for example.

Problem. The first time the user opens the application and starts scrolling through the list of cells when they reach the Ad cell, scrolling is blocked until the “Customized announcement” is created. After that, scrolling continues. Then the ad may take some time (1-2 seconds) to load the ad request.

  • The download request does not seem to be the culprit.
  • I also set up the ad programmatically, and it seems to freeze mostly when I add the ad as a subset of the cell for the first time .

Let's say an ad should appear in cell # 20, # 30, etc., the second time (and every other after that) the scroll will be continuous. This only happens for the first.

Any ideas on how to fix this would be really appreciated. Is this a problem with the GADNativeExpressAdView itself?

Thanks.

AdCollectionViewCell.Swift

class AdCollectionViewCell: UICollectionViewCell { @IBOutlet var intercellBanner: GADNativeExpressAdView! override func awakeFromNib() { super.awakeFromNib() let request = GADRequest() request.testDevices = [kGADSimulatorID] self.intercellBanner.loadRequest(request) } override func prepareForReuse() { super.prepareForReuse() let request = GADRequest() request.testDevices = [kGADSimulatorID] self.intercellBanner.loadRequest(request) } } 
+6
source share
2 answers

I wrapped the line where the request is loaded by the GCD async block, and it looks like this approach solved the scroll problem.

 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { view.nativeExpressAdView.loadRequest(request) }) 
+1
source

GitHub repo has an open problem, there are no answers yet: S

https://github.com/googleads/googleads-mobile-ios-examples/issues/24

0
source

All Articles