问题描述
我将iAd添加到TableView底部的UIVIew中,当快速向上/向下滚动时也会出错.
i add iAd into UIVIew at buttom of TableView, it also error when fast scroll up/down.
代码
- (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.
Might be easier to answer with your header file, but did you set the interface to implement the delegate interface? You need to do that in your UIViewController in order to capture the iAd messages. And don't forget to #import .
如果您使用Interface Builder进行设置-而您没有使用AFAICT进行设置,而只是即时创建iAd-则将iAd委托设置为视图时会遇到其他问题,这是通过连接iAd委托来完成的到文件所有者"套接字.
If you set things up with Interface Builder -- and AFAICT you didn't and just create the iAd on the fly -- then there are other issues with setting your iAd delegate to your view which you do by connecting the iAd delegate to the "File's Owner" socket.
无论如何,请检查您的头文件,希望对您双方都有帮助.
Anyway, check your header file and I hope this helps you both.
这篇关于iAd错误如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!