ошибка iAd как ее решить? - PullRequest
1 голос
/ 27 июля 2010

Я добавляю iAd в UIVIew в нижней части TableView, также происходит ошибка при быстрой прокрутке вверх / вниз.

код

- (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) 

1 Ответ

0 голосов
/ 09 октября 2010

Может быть проще ответить с вашим заголовочным файлом, но вы установили интерфейс для реализации интерфейса делегата? Это необходимо сделать в вашем UIViewController, чтобы перехватить сообщения iAd. И не забудьте #import.

Если вы настроили что-то с помощью Interface Builder - и AFAICT - нет, а просто создали iAd на лету - тогда возникают другие проблемы с настройкой делегата iAd на ваше представление, которое вы делаете, подключая делегат iAd в гнездо «Владелец файла».

В любом случае, проверьте ваш заголовочный файл, и я надеюсь, что это поможет вам обоим.

...