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: "Melissa J. Turner" <email@hidden>
- Date: Thu, 22 Oct 2009 16:59:47 -0700
On Oct 22, 2009, at 16:26, Sean McBride wrote:
> Hi all,
>
> Core Data is giving me a validation error when I try to save a document
> after making a simple change.
>
> I have an entity 'Scene' with a to-many relationship to an entity
> 'Target'. The inverse relationship is also to-many. Both relationships
> are optional and the delete rule for both sides is nullify.
>
> To repro, I delete all Scenes then try to save. It gives:
>
> "Dangling reference to an invalid object." = <null>;
> NSAffectedObjectsErrorKey = (
> <BSScene: 0x2004ff940> (entity: Scene; id: 0x2004f32a0 <x-coredata://
> FCE3E0E3-F187-4C44-BFC3-60D7AF3E579F/Scene/p343> ; ...
>
> This error gives only 4 hits with Google. :(
>
> The problem is that some Targets still have relationships to some
> Scenes! How can that happen? It seems like the delete rule is not
> doing its job.
>
> I've confirmed that each Scene receives prepareForDeletion. None of the
> Scenes are finalized, they are all strongly referenced by the moc's
> _deletedObjects ivar.
>
> Any advice on how to debug this?
>
> (I can repro this with 2 customer-provided documents, but I've not been
> able to create a document with this problem myself. Happens on 10.5.8
> and 10.6.1; my app is garbage collected.)
>
Does the object with the ID <x-coredata://FCE3E0E3-F187-4C44-BFC3-60D7AF3E579F/Scene/p343> exist in the affected store? What happens when you call existingObjectWithID:error:?
Do you know what version of the OS the bad documents were created on? A lot changed in the relationship handling area in 10.6 (for the better, really and truly ;-), so knowing whether your customers created them on 10.5.x or 10.6.x would help narrow down the possibilities.
+Melissa
_______________________________________________
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