I have an adwhirlview in my navigation controller at the "2nd page" so it's root -> adwhirlpage.
The showing of the banner goes great, but if I pop the navigationcontroller back to root, after 20 secs or so, the debugger gives me an error:
-[__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)
My code is as follows:
-(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];
}
I hope you guys can help me with removing this error, which thus gives the already placed error.
Cheers