Adwhirl在导航控制器内部出错

时间:2012-10-22 14:25:49

标签: iphone xcode adwhirl

我的导航控制器在“第二页”上有一个adwhirlview,所以它是root - > adwhirlpage。

横幅的显示效果很好,但是如果我将导航控制器弹回root,大约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];
}

我希望你们可以帮我解决这个错误,从而解决已经发生的错误。

干杯

2 个答案:

答案 0 :(得分:0)

您在NSTimer上调用UINavigationController方法。那不行。

  

- [__ NSCFTimer viewControllerForPresentingModalView]:无法识别的选择器发送到实例0xa8a5cc0

答案 1 :(得分:0)

如果您在从超级视图中删除self.adwhirlView1的{​​{1}} {1}}之前,您仍然会收到错误消息吗?