iphone - iOS 错误选择器错误
<p><p>所以我们有一个通用应用程序,但遇到了一个奇怪的错误,似乎随机的 iOS 框架正在尝试加载我们的方法。所以这里有一些崩溃和它的调用代码。就像我说的,这似乎是随机的。它发生在应用程序中的随机位置、随机时间以及 iPhone 和 iPad 上。</p>
<blockquote>
<p>: unrecognized selector sent to instance 0x1f3f30</p>
<p>: unrecognized selector sent to instance 0x195ea0</p>
<p>: unrecognized selector sent to instance 0x19f950</p>
<p>: unrecognized selector sent to instance 0x106e20</p>
<p>: unrecognized selector sent to instance 0x521b670</p>
</blockquote>
<p>这里是那些引用的代码。不管什么原因……</p>
<pre><code>- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
if (!_adBannerViewIsVisible) {
_adBannerViewIsVisible = YES;
.orientation];
NSLog(@"iAD Loaded");
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
NSLog(@"%@",error);
if (_adBannerViewIsVisible)
{
_adBannerViewIsVisible = NO;
.orientation];
NSLog(@"iAD Unloaded");
}
}
</code></pre>
<p>编辑:我认为我们已经将范围缩小到这些。你们能看出这里有什么明显的问题吗?</p>
<pre><code>- (void)createAdBannerView {
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if (classAdBannerView != nil) {
;
;
self.adBannerView = [ initWithFrame:CGRectZero];
];
if (UIInterfaceOrientationIsLandscape(.orientation)) {
;
} else {
;
}
, 0, -)];
;
;
}
}
- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
if (![ boolForKey:@"isadFreeUpgradePurchased"]) {
if (_adBannerView != nil) {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
;
} else {
;
}
;
if (_adBannerViewIsVisible) {
CGRect adBannerViewFrame = ;
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = 0;
;
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = ;
contentViewFrame.size.height = self.view.frame.size.height - ;
_contentView.frame = contentViewFrame;
} else {
CGRect adBannerViewFrame = ;
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = -;
;
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = 0;
contentViewFrame.size.height = self.view.frame.size.height;
_contentView.frame = contentViewFrame;
}
;
}
}
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><blockquote>
<p>it seems like random iOS frameworks are trying to load our methods</p>
</blockquote>
<p>你把它倒过来了,你正在将这些消息发送到随机框架对象。这几乎总是表明您有一个指向已释放对象的指针,而您向该对象发送消息的尝试却被发送到相同内存地址的某个新对象。</p>
<p>您需要查找包含这些方法的类的用户,并确定您尝试访问已发布实例的位置。</p></p>
<p style="font-size: 20px;">关于iphone - iOS 错误选择器错误,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/4600966/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/4600966/
</a>
</p>
页:
[1]