iAd interstitial delegate methods doesn't get

2019-06-25 11:40发布

问题:

I want to use interstitial ads in my app, so I implemented all necessary delegate methods. The problem is, if I use [self requestInterstitialAdPresentation] to show the ad, only the interstitialAdDidLoad: method gets called. The interstitialAdActionDidFinish: methods doesn't get called...

But if I use the deprecated [self.interstitial presentFromViewController:self] to show the ad, everything works.

Is there anything new to implement to get things work ?

Thanks in advance

回答1:

Ok, I resolved the problem.

Since IOS7 with its iAd Additions there's no need for an adInterstitialDelegate. The only thing to do, is preparing the ads or set the interstitialPresentationPolicy to something other than none (as you can read in the documentation) and as a last step requesting the ad using the requestInterstitialAdPresentation: method.



回答2:

iOS 9.2.1, Xcode 7.2.1, ARC enabled

@Jellyjoey I confirmed, viewDidAppear is called when the ad is closed. And as you might expect, when you tap the ad, viewDidDisappear gets called.

It has to do with how you are presenting the interstitial ad:

Completing an Advertising Action

If the full-screen ad displayed the rich media ad inside your app, it calls your delegate’s interstitialAdActionDidFinish: method after the ad finishes. Your implementation of this method should restore any services paused by your app when the action started.

Important: If your app was moved into the background because the willLeave parameter was YES, then the app’s user interface is never covered by the banner view and your app does not receive a call to interstitialAdActionDidFinish:. However, if your interface was covered by the banner view, your app could still be moved into the background later, either because the advertisement launched another app or because the user chose to do so. In all cases, if your user interface was covered by the banner view, it is uncovered and your delegate’s interstitialAdActionDidFinish: is invoked before your app moves to the background. Because the app may be moving into the background, your delegate should return quickly from its interstitialAdActionDidFinish: method.

To view the excerpt above and the rest of the guidelines for interstitial ads:

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/iAd_Guide/Full-ScreenAdvertisements/Full-ScreenAdvertisements.html#//apple_ref/doc/uid/TP40009881-CH5-SW24

Here are two examples provided by Apple of how to use full page ads:

https://developer.apple.com/library/ios/samplecode/iAdInterstitialSuite/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010627-Intro-DontLinkElementID_2