Re: Core Data relationship fault
Re: Core Data relationship fault
- Subject: Re: Core Data relationship fault
- From: Quincey Morris <email@hidden>
- Date: Mon, 11 Apr 2011 12:09:57 -0700
On Apr 11, 2011, at 11:48, Jerry Krinock wrote:
> On 2011 Apr 11, at 09:54, Lynn Barton wrote:
>
>> When I select a "department" object I have no trouble accessing any of its other properties, but when I try to get its "employees" I get only a relationship fault.
>
>> I am trying to calculate a transient property
>
> I'd bet that's the problem. In my experience, transient properties are all pain (lotsa gotchas) with no (performance) gain. Consider either making it a regular property, or, probably better for your case since a table view can only show several tens of rows at a time, calculating it as a derived attribute. For the latter, remember your friend +keyPathsForValuesAffecting<Foo>.
Darn it, I was trying to stay out of this thread because I don't know the answer, but you made me jump in ...
I feel for your pain, but I think there's a baby/bathwater issue with generalizing your experience. For things that really are transient, transient properties are very harmless, and don't need to be avoided.
The differing points of view come from Core Data's dual personality. In its role as an object graph manager, the developer tends to be focused on in-memory relationships, and transient properties are useful. In its role as an (cough!) almost-DBMS (cough!), the developer tends to be focused on fetches, and that's where you run into the gotchas.
Regarding the OP's question, my guess is that it's a memory management problem, and the object properties are faulted out because the objects themselves have been deleted from the MOC and/or deallocated. I have no evidence for that opinion.
_______________________________________________
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