Re: Help debugging "Dangling reference to an invalid object." Core Data error
Re: Help debugging "Dangling reference to an invalid object." Core Data error
- Subject: Re: Help debugging "Dangling reference to an invalid object." Core Data error
- From: "Sean McBride" <email@hidden>
- Date: Fri, 30 Oct 2009 14:04:23 -0400
- Organization: Rogue Research Inc.
On 10/29/09 5:23 PM, Ben Trumbull said:
>> Even if I do [scene addTargetsWeak:[scene targetsWeak]] I get the error.
>>
>> Does this make any sense to anyone?
>
>The only caveat is you cannot change relationships from within -
>awakeFromFetch. This is documented:
Ben,
This is something I know and avoid, but it turns out this is what's
happening afterall! Thanks!
Is there some way to catch such violations? I suppose I could implement
all relationship mutating methods, call backtrace(), and look for
awakeFromFetch. :)
Basically, I have a controller class that uses KVO to observe all kinds
of things. And I'm suffering from a kind of spaghetti chain of KVO and
faulting. In my observeValueForKeyPath:ofObject:change:context: I
sometimes end up firing a fault of some object, which causes me to
reenter my observeValueForKeyPath: for some other 'context', which ends
up firing a fault of some other object, etc. At some point
awakeFromFetch is in the backtrace and at some later point I mutate a
relationship. Ick.
This suggests to me a design flaw in my code....
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden