簡體   English   中英

iAd錯誤如何解決?

[英]iAd error how to resolve it?

我將iAd添加到TableView底部的UIVIew中,當快速向上/向下滾動時也會出錯。

- (void)viewDidLoad {
    //NSLog(@"viewDidLoad");
    if(NSClassFromString(@"ADBannerView") != nil) {
        ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0,0,0,0)];
        adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
        adView.delegate = self;
        adView.hidden = YES;
        [self.iAdBanner addSubview:adView];
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // assumes the banner view is at the top of the screen.
        adView.frame = CGRectOffset(adView.frame, 0, -150);
        [UIView commitAnimations];
        //[adView release];
    }
    else {
        //NSLog(@"iad not available");
    }

    [super viewDidLoad];
}

- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
    //NSLog(@"bannerViewDidLoadAd");
    //[self moveBannerViewOnscreen];
    if (banner.hidden)
    {
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        // assumes the banner view is offset 50 pixels so that it is not visible.
        banner.frame = CGRectOffset(banner.frame, 0, 150);
        banner.hidden = NO;
        [UIView commitAnimations];
        //self.bannerIsVisible = YES;
    }
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    //NSLog(@"bannerView error");
    //[self moveBannerViewOffscreen];
    //* 
    if (!banner.hidden)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // assumes the banner view is at the top of the screen.
        banner.frame = CGRectOffset(banner.frame, 0, -150);
        [UIView commitAnimations];//*/
        banner.hidden = YES;
    }
}

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
    //NSLog(@"bannerViewActionShouldBegin");
    //[super bannerViewActionShouldBegin:banner willLeaveApplication:willLeave];
    return YES;
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner {
    //NSLog(@"bannerViewActionDidFinish");
}

錯誤記錄

2010-07-27 11:58:58.547 PantipCafe[730:307] ******* Accessibility Status Changed: On
2010-07-27 11:58:59.068 PantipCafe[730:307] ********** Loading AX for: com.ragopor.pantip ************
2010-07-27 11:59:01.345 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 11:59:05.182 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 11:59:11.653 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 11:59:13.224 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 11:59:25.437 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 11:59:28.434 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 12:00:06.220 PantipCafe[730:307] CPDistributedMessagingCenter attempting to send reply to a dead port. Reply keys: (null)
2010-07-27 12:00:10.241 PantipCafe[730:307] -[__NSCFType bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0x544e9b0
2010-07-27 12:00:10.265 PantipCafe[730:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0x544e9b0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x3303ffd3 __exceptionPreprocess + 114
    1   libobjc.A.dylib                     0x309e7871 objc_exception_throw + 24
    2   CoreFoundation                      0x33043a77 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
    3   CoreFoundation                      0x33042f15 ___forwarding___ + 508
    4   CoreFoundation                      0x32fd5680 _CF_forwarding_prep_0 + 48
    5   iAd                                 0x31bdc25d -[ADBannerView _sanitizeAndForwardErrorToDelegate:] + 48
    6   iAd                                 0x31bdafcf -[ADBannerView sessionBannerViewDidFailToReceiveAd:withError:] + 38
    7   iAd                                 0x31be8ca9 -[ADSession bannerViewDidFailToReceiveAddWithErrorMessage:userInfo:auditToken:] + 116
    8   AppSupport                          0x32a4d0b5 -[CPDistributedMessagingCenter _dispatchMessageNamed:userInfo:reply:auditToken:] + 172
    9   AppSupport                          0x32a4df87 processMessage + 514
    10  AppSupport                          0x32a4e1cb _CPDMMessage + 74
    11  AppSupport                          0x32a4ede9 _XMessage + 248
    12  AppSupport                          0x32a412c3 migHelperRecievePortCallout + 138
    13  CoreFoundation                      0x33015aab __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
    14  CoreFoundation                      0x3301784f __CFRunLoopDoSource1 + 166
    15  CoreFoundation                      0x3301862d __CFRunLoopRun + 520
    16  CoreFoundation                      0x32fc18eb CFRunLoopRunSpecific + 230
    17  CoreFoundation                      0x32fc17f3 CFRunLoopRunInMode + 58
    18  GraphicsServices                    0x302dd673 GSEventRunModal + 114
    19  GraphicsServices                    0x302dd71f GSEventRun + 62
    20  UIKit                               0x33720cff -[UIApplication _run] + 402
    21  UIKit                               0x3371f8c7 UIApplicationMain + 670
    22  PantipCafe                          0x00002ceb main + 42
    23  PantipCafe                          0x00002c88 start + 52
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.
(gdb) 

頭文件可能更容易回答,但是您是否設置了接口以實現委托接口? 您需要在UIViewController中執行此操作,以捕獲iAd消息。 並且不要忘記#import。

如果您使用Interface Builder進行設置-而您並沒有使用AFAICT進行操作,而只是即時創建iAd-則將iAd委托設置為視圖時會遇到其他問題,方法是將iAd委托連接到“文件的所有者”套接字。

無論如何,請檢查您的頭文件,希望對您有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM