Re: "Dangling reference to an invalid object"
Re: "Dangling reference to an invalid object"
- Subject: Re: "Dangling reference to an invalid object"
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 03 Dec 2012 11:13:06 -0700
On Dec 1, 2012, at 10:33 AM, Mike Abdullah <email@hidden> wrote:
> I've been trying to hunt down a problem where Core Data will occasionally refuse to save with the error "
> Dangling reference to an invalid object". I wrote up the details here: http://www.mikeabdullah.net/dangling-ref-to-an-invalid-object.html
>
> Can anyone shed some light on how this might happen?
This exception happens if you:
1. Create a new object
2. Create a relationship between the new object and an existing object
3. Turn the new object into a fault before it is officially inserted
4. Save changes
So if you're getting this exception, you need to be more careful about using the -refreshObject:mergeChanges: method, because the code is most likely misusing it. One way to fix this is to never refresh an object that has a temporary object ID.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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