2010-07-27 8 views
1

J'ajoute iAd dans UIVIew au bout de TableView, il y a aussi une erreur lors du défilement rapide haut/bas.Erreur iAd comment le résoudre?

code

- (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"); 
} 

Error Log

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) 
+0

J'ai examiné ce problème et il est possible qu'il ne se produise que sur certaines versions d'iOS. Quelles versions d'iOS cela vous arrive-t-il? – ThomasW

Répondre

0

pourrait être plus facile de répondre avec votre fichier d'en-tête, mais avez-vous mis l'interface pour implémenter l'interface délégué? Vous devez le faire dans votre UIViewController afin de capturer les messages iAd. Et n'oubliez pas #import.

Si vous configurez des interfaces avec Interface Builder - et AFAICT vous ne l'avez pas fait et que vous créez l'iAd à la volée - il y a d'autres problèmes avec votre délégué iAd que vous faites en connectant l'iAd déléguer à la socket "File's Owner".

Quoi qu'il en soit, vérifiez votre fichier d'en-tête et j'espère que cela vous aide tous les deux.

Questions connexes