Re: Core Data : User missing inverse relationship despite model settings
Re: Core Data : User missing inverse relationship despite model settings
- Subject: Re: Core Data : User missing inverse relationship despite model settings
- From: Sean McBride <email@hidden>
- Date: Mon, 08 Aug 2011 12:43:04 -0400
- Organization: Rogue Research Inc.
On Mon, 8 Aug 2011 01:12:36 -0700, Jerry Krinock said:
>The reports indicate (rather strangely, but I'm watching my word count
>here) that the problem is "Dangling reference to an invalid object".
>Searching list archives tells me that this has been due to setting a
>relationship in -awakeFromFetch, which is illegal. But I checked my
>project carefully and I'm not doing that.
hmmm, I'm having deja vu. Are you sure you're not setting a relationship in awakeFromFetch? IIRC, when I had a similar problem, it was because of an unanticipated chain of faulting/fetching that caused awakeFrom to be somewhere on the backtrace. Ahh, here's the Radar... rdar://7361717
---
03-Nov-2009 05:25 PM Sean McBride:
The docs for awakeFromFetch warn "you should not modify relationships in this method as the inverse will not be set".
Despite knowing that well (after learning it the hard way long ago), I found another place where I do so. But not in a direct way! A controller object is using KVO to observe many things. Sometimes in response to these changes, it ends of firing a fault, which leads to more KVO, etc. Suffice to say that I ended up with awakeFromFetch in the backtrace (30 frames ago) and then changed a relationship. :(
It would be great if the Core Data _debug variant could test for this and warn if it detects it happening.
---
I remember thinking that mogenerator could be changed to implement awakeFromFetch everywhere, call backtrace() and assert, but never got to it...
hth,
--
____________________________________________________________
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