我在“第二页”的导航控制器中有一个 adwhirlview,所以它是 root -> adwhirlpage。
横幅的显示效果很好,但是如果我将导航控制器弹出回根目录,大约 20 秒后,调试器会给我一个错误:
-[__NSCFTimer viewControllerForPresentingModalView]: unrecognized selector sent to instance 0xa8a5cc0
2012-10-22 16:22:49.173 Tap Chap backup[1376:1be03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFTimer viewControllerForPresentingModalView]: unrecognized selector sent to instance 0xa8a5cc0'
*** First throw call stack:
(0x1ddb022 0x2e4ccd6 0x1ddccbd 0x1d41ed0 0x1d41cb2 0xe806 0x1d172 0x1c63e 0x1d331 0x1731eb6 0x1daf936 0x1daf3d7 0x1d12790 0x1d11d84 0x1d11c9b 0x23947d8 0x239488a 0xdf5626 0x2dea 0x2d35)
terminate called throwing an exception(lldb)
我的代码如下:
-(IBAction)backMainMenu
{
[self.navigationController popViewControllerAnimated:YES];
[self.adwhirlView1 removeFromSuperview];
}
- (void)viewDidLoad
{
[self showBanner];
}
-(UIViewController *)viewControllerForPresentingModalView
{
return self.navigationController;
}
-(NSString *)adWhirlApplicationKey
{
return @"my key";
}
-(void)showBanner
{
self.adwhirlView1 = [AdWhirlView requestAdWhirlViewWithDelegate:self];
// adwhirlView1.bounds = CGRectMake(0.0, 0.0, 480, 50);
[self.navigationController.view addSubview:self.adwhirlView1];
}
-(void)adWhirlDidReceiveAd:(AdWhirlView *) adWhirlView
{
[UIView beginAnimations:@"AdWhirlDelegate.adWhirlDidReceiveAd:" context:nil];
[UIView setAnimationDuration:0.7];
CGSize adSize = [adwhirlView1 actualAdSize];
CGRect newFrame = adwhirlView1.frame;
newFrame.size = adSize;
newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
adwhirlView1.frame = newFrame;
CGAffineTransform makeLandscape = CGAffineTransformMakeRotation(degreesToRadians(0));
makeLandscape = CGAffineTransformTranslate(makeLandscape, -480/2 + 48/2, 320/2 - 48/2 - 12);
makeLandscape = CGAffineTransformScale(makeLandscape, 480.0/320, 480.0/320);
adwhirlView1.transform = makeLandscape;
adwhirlView1.frame = CGRectMake(0, 250, 480, 100);
[UIView commitAnimations];
}
我希望你们能帮助我消除这个错误,从而给出已经放置的错误。
干杯