Reputation: 16010
My setup:
There's a UITabBarController
. In the first tab - there's a UINavigationController
with a UITableViewController
as a root viewcontroller.
In the table of UITableViewController
, one of the cells contains a GADBannerView
In the cell with the bannerView, I'm loading the ad like this:
var bannerView: GADBannerView = GADBannerView()
......
bannerView?.adUnitID = "<my adUnitId>"
bannerView?.adSize = kGADAdSizeMediumRectangle
let request = GADRequest()
request.contentURL = "<my site>"
bannerView?.load(request)
Problem:
I've noticed, that if the ad contains the video/animation - after switching between tabs - the CPU usage is still high and remains on 15-20% load forever (until you kill the app).
Actual ad looks like this:
A couple observations:
func adViewDidReceiveAd(_ bannerView: GADBannerView)
is not being called, i.e. the framework knows that the ad is no longer on the screenThis is how processes look like (after switching to another, ad-free tab):
Version of the AdMob:
'Firebase/AdMob', '~>5.15.0' (from cocoapods)
Any suggestions are very welcomed.
Upvotes: 2
Views: 576
Reputation: 279
I faced the same problem and solved it by removing the banner every time the ad goes off screen add (re-) add it if it's visible again. This might happen in three cases:
tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath)
viewWillDisappear
appDidEnterBackground
Upvotes: 0