> 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.

This error happens when the MOC for a destination object is nil, the object is 
in a relationship but marked deleted, or the object in a relationship has a 
temporary objectID but is not marked inserted.  Using 
refreshObject:mergeChanges:NO on an object with pending changes can do some of 
that, as can assigning a deleted object to new relationships after delete 
propagation has run.

- Ben



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to