The headers for canDisplayBannerAds
state:
Set this to enable automatic management of banner ad display with the
view controller.
It's important to note that this will modify the view hierarchy of the view controller
by inserting a new container view above the view controller's view. The impact
is that the view controller's view property will no longer return the originally
provided view, it will return the new container. To access the original view,
use the originalContentView property.
What is not clear is that automatic management also refers to instantiating and inserting an ADBannerView
into your view hierarchy. You do not need to instantiate an ADBannerView
, and you do not need an ADBannerView property or instance variable.
You will still want to adhere to the ADBannerViewDelegate
protocol in your view controller so you can pause your application when the user taps the ad, and then resume when the fullscreen ad goes away.
Update: Unless you want to walk through the view hierarchy looking for the automatically inserted ADBannerView
to set your view controller as a delegate, you can also cut the ADBannerViewDelegate
protocol methods.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…