iOS - 奇怪的例外 [英] iOS – Weird exception

查看:120
本文介绍了iOS - 奇怪的例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 4.2.1(启用ARC的项目)中,我遇到了一个奇怪的异常,我无法跟踪问题的根源。

I'm getting a strange exception in Xcode 4.2.1 (ARC-enabled project) that I can't track down to the root of the problem.

这是例外情况:

2012-03-18 22:19:32.855 Project[14225:707] +[UIPickerTableViewTitledCell isEqualToString:]: unrecognized selector sent to class 0x3f2bbec4
2012-03-18 22:19:32.859 Project[14225:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIPickerTableViewTitledCell isEqualToString:]: unrecognized selector sent to class 0x3f2bbec4'

什么是UIPickerTableViewTitledCell?我想它是一些内部类为UIPickerView使用。但我不是在我的项目中的任何地方引用该类。

What is a UIPickerTableViewTitledCell? I suppose it is some internal class for the UIPickerView to use. But I'm not referencing that class anywhere in my project.

我的应用程序设置为一个Tab Bar应用程序,每个选项卡中都有一个导航控制器, tableview和pickerview。

My application is setup as a Tab Bar application with a navigation controller in each tab and this particular tab has a tableview and pickerview.

推荐答案

听起来你有一个过度释放的对象。我得到,当在pre-ARC代码,释放被称为太多次。代码听起来像是在寻找一个NSString发送isEqualToString:但是,而不是得到已经发布的NSString,它获得这个随机的UIPickerTableViewTitledCell实例。

It sounds like you have an over-released object. I get that when in pre-ARC code, release is called one too many times. The code sounds like it is looking for an NSString to send isEqualToString: to but instead of getting the NSString which has been released already, it gets this random instance of UIPickerTableViewTitledCell.

我会启用僵尸。在Xcode 4.2.1中,您可以在菜单项 Product>中找到它。编辑方案。转到诊断选项卡。然后有一个 Enable Zombie Objects 复选框。这将使你过度释放的对象成为一个僵尸,所以你可以弄清楚什么对象导致你的崩溃。

I would enable Zombies. In Xcode 4.2.1, you can find it in the menu item Product > Edit Scheme. Go to the Diagnostics tab. Then there is an Enable Zombie Objects checkbox. This will make your over-released object into a Zombie, so you can figure out exactly what object is causing your crash.

我会阅读苹果文档技术说明TN2239:iOS调试魔术,以获取有关此方面的更多深入信息。整个文档是伟大的,但你可以开始阅读的章节标题为僵尸!和更多僵尸!

I would read the Apple doc Technical Note TN2239: iOS Debugging Magic for more in-depth information on this. The whole doc is great, but you can start off by reading the sections titled "Zombies!" and "More Zombies!"

这篇关于iOS - 奇怪的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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