Re: Problem tracking crash in iOS
Re: Problem tracking crash in iOS
- Subject: Re: Problem tracking crash in iOS
- From: Jens Alfke <email@hidden>
- Date: Mon, 21 Nov 2011 12:13:42 -0800
On Nov 21, 2011, at 12:04 PM, Doug Hill wrote: It's often that your classes can be designed such that, upon dealloc or other defined points in the object lifetime, one removes notifications. You generally don't need to query the Notification Center whether your object is registered or not as it will always need to be unregistered at dealloc.
+1. IMHO any class that registers instances with NSNotificationCenter MUST remove them in its dealloc method. Even if it already removed itself in some other method that is 100% totally guaranteed to be called first … because sometimes “100%” is really 99.44%, and 0.56% of the time you crash.
Whenever I get mysterious crashes in NSNotificationCenter, I do a quick code review of the dealloc methods of all classes that use it. This generally lets me find the problem pretty quickly.
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden