所以我们有一个通用应用程序,但遇到了一个奇怪的错误,似乎随机的 iOS 框架正在尝试加载我们的方法。所以这里有一些崩溃和它的调用代码。就像我说的,这似乎是随机的。它发生在应用程序中的随机位置、随机时间以及 iPhone 和 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
这里是那些引用的代码。不管什么原因……
- (void)bannerViewDidLoadAdADBannerView *)banner {
if (!_adBannerViewIsVisible) {
_adBannerViewIsVisible = YES;
[self fixupAdView:[UIDevice currentDevice].orientation];
NSLog(@"iAD Loaded");
}
}
- (void)bannerViewADBannerView *)banner didFailToReceiveAdWithErrorNSError *)error {
NSLog(@"%@",error);
if (_adBannerViewIsVisible)
{
_adBannerViewIsVisible = NO;
[self fixupAdView:[UIDevice currentDevice].orientation];
NSLog(@"iAD Unloaded");
}
}
编辑:我认为我们已经将范围缩小到这些。你们能看出这里有什么明显的问题吗?
- (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)fixupAdViewUIInterfaceOrientation)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];
}
}
}
Best Answer-推荐答案 strong>
it seems like random iOS frameworks are trying to load our methods
你把它倒过来了,你正在将这些消息发送到随机框架对象。这几乎总是表明您有一个指向已释放对象的指针,而您向该对象发送消息的尝试却被发送到相同内存地址的某个新对象。
您需要查找包含这些方法的类的用户,并确定您尝试访问已发布实例的位置。
关于iphone - iOS 错误选择器错误,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/4600966/
|