So we have a universal app and are getting a strange error where it seems like random iOS frameworks are trying to load our methods. So here are some of the crashes and the code its calling. Like I said it seems every random. It happens at random places in the app and at random times and on iPhone and iPad.
[__NSCFDictionary bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x1f3f30
[__NSArrayM bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x195ea0
[UILabel bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0x19f950
[ADSession bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x106e20
[__NSArrayM bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0x521b670
And here is the code those refer to. For whatever reason...
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
if (!_adBannerViewIsVisible) {
_adBannerViewIsVisible = YES;
[self fixupAdView:[UIDevice currentDevice].orientation];
NSLog(@"iAD Loaded");
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
NSLog(@"%@",error);
if (_adBannerViewIsVisible)
{
_adBannerViewIsVisible = NO;
[self fixupAdView:[UIDevice currentDevice].orientation];
NSLog(@"iAD Unloaded");
}
}
EDIT: I think we've narrowed it down to these. Can you guys see any glaring issues here?
- (void)createAdBannerView {
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if (classAdBannerView != nil) {
[classAdBannerView release];
[self.adBannerView release];
self.adBannerView = [[classAdBannerView alloc] initWithFrame:CGRectZero];
[_adBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects: ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil]];
if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
[_adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
} else {
[_adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait];
}
[_adBannerView setFrame:CGRectOffset([_adBannerView frame], 0, -[self getBannerHeight])];
[_adBannerView setDelegate:self];
[self.view addSubview:_adBannerView];
}
}
- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"isadFreeUpgradePurchased"]) {
if (_adBannerView != nil) {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
[_adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
} else {
[_adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait];
}
[UIView beginAnimations:@"fixupViews" context:nil];
if (_adBannerViewIsVisible) {
CGRect adBannerViewFrame = [_adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = 0;
[_adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = [self getBannerHeight:toInterfaceOrientation];
contentViewFrame.size.height = self.view.frame.size.height - [self getBannerHeight:toInterfaceOrientation];
_contentView.frame = contentViewFrame;
} else {
CGRect adBannerViewFrame = [_adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = -[self getBannerHeight:toInterfaceOrientation];
[_adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = 0;
contentViewFrame.size.height = self.view.frame.size.height;
_contentView.frame = contentViewFrame;
}
[UIView commitAnimations];
}
}
}