UIImageView initWithCoder - 无法识别的选择器发送到实例... iOS 5 beta SDK [英] UIImageView initWithCoder - unrecognized selector sent to instance... iOS 5 beta SDK

查看:102
本文介绍了UIImageView initWithCoder - 无法识别的选择器发送到实例... iOS 5 beta SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果已经被问过我很抱歉,问题就出现了:

I'm sorry if it has already been asked, but here comes the problem:

我最近将我的SDK更新为 iOS 5 beta 即可。我的应用程序在新的模拟器上构建并运行完美,但是当我尝试将部署目标更改为较旧的iOS( 4.3 )时,应用程序在尝试使用 UIActivityIndi​​catorView时立即崩溃/ strong>控制(模拟器和设备)。我在一个非常简单的加载视图中使用 UIActivityIndi​​catorView ,该视图仅包含 View UIActivityIndi​​catorView

I've recently updated my SDK to iOS 5 beta. My app builds and runs perfectly fine on the new simulator, but when I try to change the Deployment Target to the older iOS (4.3), the app crashes instantly when it tries to use UIActivityIndicatorView control (both simulator and device). I'm using the UIActivityIndicatorView in a really simple loading view consisting only of a View and UIActivityIndicatorView.

当我从该视图中删除 UIActivityIndi​​catorView 控件时,视图工作正常,应用程序在加载其他内容时崩溃视图(带有活动指示符和图像)。所以,长话短说:app在iOS 5环境中运行良好,但图像和活动指示器在旧iOS版本上运行时会崩溃。有什么想法吗?

When I remove UIActivityIndicatorView control from that view, the view works fine, BUT the app crashes while loading other views (with activity indicators and images). So, the long story short: app works fine in the iOS 5 environment, but images and activity indicators crash it while running it on older iOS versions. Any ideas?

提前致谢!

编辑

我正在添加一些代码只是为了向您展示我是如何使用视图的。它真的不多, LoadingViewController 本身绝对没有自定义代码(所有控件都在笔尖中)。

I'm adding some code just to show you guys how I'm using the view. It's really not much and the LoadingViewController itself has absolutely no custom code (all controls are in the nib).

if(!self.loadingScreen){
    self.loadingScreen = [[LoadingViewController alloc] initWithNibName:@"LoadingViewController" bundle:nil];
}
[self.view addSubview:loadingScreen.view];

异常消息实际上并没有多说,但是你走了:

The exception message doesn't actually say much more, but here you go:

0   CoreFoundation                      0x017bd5a9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x01911313 objc_exception_throw + 44
2   CoreFoundation                      0x017bf0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3   CoreFoundation                      0x0172e966 ___forwarding___ + 966
4   CoreFoundation                      0x0172e522 _CF_forwarding_prep_0 + 50
5   UIKit                               0x00f8e9fd UINibDecoderDecodeObjectForValue + 2592
6   UIKit                               0x00f8f6ac -[UINibDecoder decodeObjectForKey:] + 398
7   UIKit                               0x00d75db0 -[UIImageView initWithCoder:] + 97


推荐答案

根据smith324的建议,我开始浏览Apple dev论坛以找出我f我做错了或者SDK中有错误。事实证明,最新版本中有一个令人讨厌的错误,就像在我的情况下崩溃了UIImages,UIActivityIndi​​cators等。好消息是,实际上有一种解决方法,你可以在这里找到它: https://devforums.apple.com/message/507796#507796

Following smith324's advice I started to browse Apple dev forums to find out if I'm doing something wrong or if there's a bug in the SDK. It turns out, that there's a nasty bug in the latest release crashing UIImages, UIActivityIndicators etc. just like in my case. Good news is, there actually is a workaround and you can find it here: https://devforums.apple.com/message/507796#507796

感谢大家的帮助!

编辑:

如果您无法访问该链接,建议您回答:

If you can't access the link, this is the suggested answer:

@implementation UIImage (initWithCoder)

- (id)initWithCoder:(NSCoder *)aDecoder
{
     return nil;
}

@end

这篇关于UIImageView initWithCoder - 无法识别的选择器发送到实例... iOS 5 beta SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆