我在禁用 wifi 的情况下运行我的应用程序,我总是在调试器中得到空白和这条消息:
ADBannerView:未处理的错误(没有委托或委托未实现 didFailToReceiveAdWithError:):错误域 = ADErrorDomain Code = 5“操作无法完成。横幅视图可见但没有内容” UserInfo = 0x9632d30 {ADInternalErrorCode = 5, NSLocalizedFailureReason=横幅视图可见但没有内容}
请帮我修复我的代码:.h
#import <iAd/iAd.h>
@interface ViewController : UIViewController <GKAchievementViewControllerDelegate, GameCenterManagerDelegate , ADBannerViewDelegate> {
//iAD
ADBannerView *banner;
}
//iAD
@property (nonatomic, assign) BOOL bannerIsVisible;
@property (nonatomic, retain) IBOutlet ADBannerView *banner;
.m
@synthesize banner , bannerIsVisible;
-(void)bannerViewDidLoadAd:(ADBannerView *)abanner {
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animatedAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0.0, 50.0);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}}
-(void)bannerView:(ADBannerView *)aBanner didFailToReceiveAdWithError:(NSError *)error {
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animatedAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0.0, -50.0);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}