如何知道postNotificationName:object:userInfo的崩溃 [英] How to know where crash for postNotificationName:object:userInfo

查看:1127
本文介绍了如何知道postNotificationName:object:userInfo的崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以知道Xcode 4.6中的崩溃原因吗?

Is there some method to know crash reason in Xcode 4.6?

The crash stack is :
Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0xd9f2c061
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                     0x3a74f5aa objc_msgSend + 10
1   Foundation                          0x33157599 -[NSNotificationCenter postNotificationName:object:userInfo:] + 73
2   UIKit                               0x347830cd -[UIApplication _handleApplicationSuspend:eventInfo:] + 733
3   UIKit                               0x346f91e7 -[UIApplication handleEvent:withNewEvent:] + 2459
4   UIKit                               0x346f86cd -[UIApplication sendEvent:] + 73
5   UIKit                               0x346f811b _UIApplicationHandleEvent + 6155
6   GraphicsServices                    0x363ee5a3 _PurpleEventCallback + 591


推荐答案

当向通知中心添加观察者时,必须在对象被释放/销毁时将其删除。否则通知中心会将通知发送到已销毁的对象,导致崩溃。

When you add an observer to the notification centre you have to remove it when the object is being dealloced/destroyed. Otherwise Notification Centre would send the notification to the destroyed object resulting in crash.

1 - 检查您是否正确处理从通知中心移除。 (通常你在dealloc方法上这样做)

1 - check if you properly handle the removing from notification centre. (typically you do this on dealloc method)

2 - 如果步骤1没有帮助,僵尸。它会指出哪个对象被销毁但仍然接收消息。

2 - If step 1 doesn't help, profile your application with instruments & zombies. it would point out which object is destroyed but still receiving messages.

这篇关于如何知道postNotificationName:object:userInfo的崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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