Re: Problem tracking crash in iOS
Re: Problem tracking crash in iOS
- Subject: Re: Problem tracking crash in iOS
- From: Doug Hill <email@hidden>
- Date: Mon, 21 Nov 2011 12:04:37 -0800
Matt,
This may be going beyond just an Xcode issue but I'll throw in some thoughts.
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. If it isn't obvious when your objects are registered and need to be unregistered, you can always keep some state in your object that tracks this status so you can do this at the appropriate time.
On a related note, I'm really looking forward to using "weak" properties under ARC. They seem to have all the features that would deal with these dangling pointer issues (delegates being another dangerous semantic) since they would nil out any references that were dealloc'd. I was really disappointed when, as part of our project's ARC transition, I found out that weak properties are iOS 5 only. Oh well, one of these days all of our customers will have iOS 5 and we won't need to worry about iOS 4. Eventually...
Doug Hill
Schematic Labs, Inc.
http://soundtracking.com/
On Nov 19, 2011, at 7:13 AM, Matt Neuburg wrote:
> On Wed, 16 Nov 2011 14:23:26 -0800, Laurent Daudelin <email@hidden> said:
>> I'm working on an app with a bug that is reproducible each time. Some object is trashed and the NSNotificationCenter tries to send a notification to an object that doesn't respond to that selector. I turned on NSZombieEnabled and a bunch of other settings for my debug session but when I turn on NSZombieEnabled, the crash doesn't occur and the app keeps running.
>>
>> How can I find out which object is wrongly deallocated?
>
> Part of the problem here, it seems to me, is that there is no API for querying the NSNotificationCenter as to what targets and selectors it has registered. m.
>
> --
> matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> Programming iOS 4!\
_______________________________________________
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