Google adverts load repeatedly on iOS 8

Skip to first unread message

Sep 8, 2014, 10:03:45 AM9/8/14


Are changes to UIWebView causing Google adverts to refresh on every appearance?

We are using Google's AdMob SDK (6.11.1) for iOS to display adverts. We only request a new advert when the user enters a new screen. Since iOS 8, whenever an advert goes off and on screen a new advert is loaded. This happens even for adverts in table-cells and could therefore result in a significant increase in requests for adverts which we would like to avoid. We believe this problem is occurring because of changes in the behaviour of UIWebView - the advert view is being informed that it has been reloaded and is therefore requesting a new advert. Here is an example callstack:

#0 0x003f2326 in -[AdvertView adViewDidReceiveAd:]

#1 0x00901cfd in __46-[GADBannerView slotFinishedLoadingAdContent:]_block_invoke ()

#2 0x008f0cd4 in +[GADMacros runSynchronouslyOnMainThreadWithBlock:] ()

#3 0x00901c90 in -[GADBannerView slotFinishedLoadingAdContent:] ()

#4 0x00906b07 in -[GADSlot adFinishedLoadingContent] ()

#5 0x008fd03a in -[GADBannerWebViewDelegate webViewDidFinishLoad:] ()

#6 0x021b1e09 in -[UIWebView webView:didFinishLoadForFrame:] ()

#7 0x021b3d7c in -[UIWebViewWebViewDelegate webView:didFinishLoadForFrame:] ()

#8 0x05924d4d in __invoking___ ()

#9 0x05924bf8 in -[NSInvocation invoke] ()

#10 0x059bc97a in -[NSInvocation invokeWithTarget:] ()

#11 0x0765fe80 in -[_WebSafeForwarder forwardInvocation:] ()

#12 0x0599278e in ___forwarding___ ()

#13 0x0599258e in __forwarding_prep_0___ ()

#14 0x05924d4d in __invoking___ ()

#15 0x05924bf8 in -[NSInvocation invoke] ()

#16 0x08783066 in HandleDelegateSource(void*) ()


#18 0x0595b2cd in __CFRunLoopDoSources0 ()

#19 0x0595a828 in __CFRunLoopRun ()

#20 0x0595a1ab in CFRunLoopRunSpecific ()

#21 0x05959fdb in CFRunLoopRunInMode ()

#22 0x070f724f in GSEventRunModal ()

#23 0x070f708c in GSEventRun ()

#24 0x01ef1386 in UIApplicationMain ()

#25 0x000df73c in main

#26 0x06188ac9 in start ()

Previously the adViewDidReceiveAd: would be called once when we requested an advert. Now it is being called whenever the advert is scrolled off and on screen. We have tried over-riding [GADBannerView slotFinishedLoadingAdContent:] and setting the webView's delegate to nil after loading but this only resulted in the advert disappearing.

Thanks for your help in this matter,


Sep 8, 2014, 11:17:03 AM9/8/14
Apologies, this issue manifests itself when cell-reuse is not being used. Re-using the cell with the advert in prevents this from happening. Presumably without cell-reuse the old cell is being cleaned up when it scrolls off-screen.


Sep 9, 2014, 9:51:19 AM9/9/14
We've found that (Google GADSearchBannerView and DFPBannerView) adverts will reload whenever their superview is changed on iOS 8. We use a single advert to appear twice (but not simultaneously) on the same screen. To avoid the additional request we have subclassed GADSearchBannerView and DFPBannerView and overridden setBounds to always set the bounds to a fixed size.

Eric Leichtenschlag

Sep 9, 2014, 7:06:47 PM9/9/14
If the size of any GADBannerView is changed, a new request will be fired. A workaround is to use the resize method on DFPBannerView, which won't fire a new request. But it's questionable why the banner's size should be changing anyways, as the ad currently in the view matches the old frame size.

Sep 11, 2014, 3:52:57 AM9/11/14
Hi Eric,

Thanks for the reply. I agree that the banner's size should not be changing but the operating system thinks otherwise. When we change the advert's superview we are obliged to remove the old auto-layout constraints and add new constraints and it looks like iOS8's auto-layout implementation is more enthusiastic about changing a view's bounds.

I wonder if overriding intrinsicContentSize is a better solution to overriding setBounds. I'll update here when I get a chance to try that out.


Eric Leichtenschlag

Sep 12, 2014, 3:17:28 PM9/12/14
Hmm, that is tricky, but it also begs the question of why you're changing the bannerView's superview. If you're moving the banner around, would you not want to load a new request anyways?

What happens if you wrap the GADBannerView in some other UIView, and then detaching and reattaching the UIView parent? Are the autolayout constraints on the GADBannerView to the UIView lost in that case? That might be something else worth exploring.

Sep 15, 2014, 5:57:46 AM9/15/14
We are changing the bannerView's superview because we have the same advert in the top cell of a table-view and in the footer of the same table-view. We do not want to request a new advert whenever the user scrolls to the top or bottom of the table-view.

Our GADBannerView is already wrapped in our own UIView subclass. The change in bounds when constraints are added and removed appear to be passed down the view hierarchy.

Eric Leichtenschlag

Sep 15, 2014, 5:00:43 PM9/15/14
I couldn't reproduce this when running the TableViewExample in AdCatalog on an iPhone 6 simulator running iOS8. The example also has a banner at the top and bottom of the table view, and changes the parent view when getting the cell for that index. I don't know if auto-layout is the problem, but I think your issue is implementation dependent, and can't be fixed in the SDK without changing the SDKs current and intentional behavior of loading a new request on size change.
Reply all
Reply to author
0 new messages