NSDictionary objectForKey iPhone模拟器和iPhone设备

发布于 2024-12-19 16:19:29 字数 531 浏览 2 评论 0原文

我有这个函数 return [remoteObject objectForKey:key]; ,它应该返回我字典中的一个对象。

当我启动 Iphone 模拟器时,一切都很好并且它返回正确的对象。 但是当我在我的设备上启动同一个应用程序时,我的应用程序崩溃了,并且显示 SIGABRT 和

2011-12-05 10:25:17.601 iPhoneXMPP[242:1a1f] -[CALayer objectForKey:]: 无法识别的选择器发送到实例 0x4f3d40 2011-12-05 10:25:17.602 iPhoneXMPP[242:1a1f] * 由于未捕获而终止应用程序 异常'NSInvalidArgumentException',原因:'-[CALayer objectForKey:]: 无法识别的选择器发送到实例 0x4f3d40'

我的密钥是一个 Id (17),它也在我的字典中。

你们有人知道为什么这种情况只发生在我的设备上吗?

I have this function return [remoteObject objectForKey:key]; which should return an object that is in my dictionary.

When I am starting the Iphone simulator everything is fine and it returns the right object.
But when I am starting the same application an my device my application crashes and it says SIGABRT
and

2011-12-05 10:25:17.601 iPhoneXMPP[242:1a1f] -[CALayer objectForKey:]:
unrecognized selector sent to instance 0x4f3d40 2011-12-05
10:25:17.602 iPhoneXMPP[242:1a1f] * Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[CALayer
objectForKey:]: unrecognized selector sent to instance 0x4f3d40'

My key is an Id (17) and it is also in my dictionary.

Does anybody of you knows why this happens only on my device?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒废 2024-12-26 16:19:29

这意味着您的 remoteObject 对象正在某处被释放。通常,自动释放在设备上发生得更快,因为它的内存比模拟器少,这就是为什么在模拟器上,当您尝试调用它的方法时,您的对象仍然存在。确保在创建对象时调用retain,并在使用完对象后调用release

It means that your remoteObjectobject is being deallocated somewhere. Usually autoreleases happen faster on the device because it has less memory than the simulator that's why on the simulator your object is still there when you are trying to call it's method. Make sure you call retainon your object when you created it and release when you are done with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文