如果我在 XCode 5.0.2 中创建一个新的单视图项目,添加 iAd 框架,在 ViewController.h 中实现 ADInterstitialAdDelegate
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface ViewController : UIViewController <ADInterstitialAdDelegate>
@end
以及 ViewController.m 中的委托方法
-(void)viewDidLoad
{
[super viewDidLoad];
[ self performSelector:@selector(onDelay) withObject:nil afterDelay:2 ];
}
-(void)onDelay
{
self.interstitialPresentationPolicy = ADInterstitialPresentationPolicyManual;
[ self requestInterstitialAdPresentation ];
}
-(void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error
{
NSLog(@"interstitialAd didFailWithError");
}
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd
{
NSLog(@"interstitialAdDidLoad");
}
没有调用任何 ADInterstitialAdDelegate 方法。我在使用 iOS 6 及更低版本中的旧实现时也遇到了一些问题
interstitial = [[ADInterstitialAd alloc] init];
interstitial.delegate = self;
[ interstitial presentFromViewController:self ];
仅有的
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd
然后被调用,但没有
- (void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd
关闭广告后。有没有人记得有同样的问题或知道这里发生了什么?