CoreData Dangling Reference
CoreData Dangling Reference
- Subject: CoreData Dangling Reference
- From: Milen Dzhumerov <email@hidden>
- Date: Sat, 17 Oct 2009 20:26:04 +0100
Hi all,
I've started getting some dangling references which I cannot figure
out. Basically, I've got the following class setup:
A <---------->> B <<----------> C
where A has-many to B, C has -many to B and B has-one to both A and C.
What happens on quit is that I get the following error: "Dangling
reference to an invalid object." = <null>;. This happens when I try to
delete an instance of B (the reason for the error is that C still has
a reference to B which is already deleted). Before actually deleting
the object, I do:
b.a = nil; (3)
b.c = nil; (4)
I poked around to see what's happening under the hood and noticed two
things:
1) When I delete the object from the context, the delete rule doesn't
get executed. So, if I leave (3) and (4) out, object instance b will
still point to instances of A and C even though the delete rule is
nullify. In summary, for some unknown reason, deleting the object
doesn't invoke the delete rule.
2) Out of (3) and (4), only one of the statements nullifies the
reverse relationship while the other one doesn't.
So I setup a small project just to test out that deleting an object
nullifies links and indeed it does. So now, I'm out of options on how
to debug this problem. Any tips are greatly appreciate.
M
_______________________________________________
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