Hi Keary Esoteritech, I like it!
I am using only 1 context. Right now I've capture de basic code doing this: Initiating the data connexion from the main window using an NSFetchedResultsController that is loading (well its empty now...) the list of item A. This guy is on a property in my main controller and the controller is a delegate for it, it responds to the update notifications. In a button handler, I create an object A, then a child B then and child C to B. Save this whole thing, all is ok. Meanwhile I kept an "unprotected" reference to object C I've juste created and saved. I call context deleteObject on it then save. Now I get all the time this CoreData could not fulfill a fault for error. Thx! Eric. On 2012-03-01, at 14:57, Keary Suska wrote: > On Mar 1, 2012, at 7:12 AM, Eric Giguere wrote: > >> I'm on the verge of loosing my sanity... I've been running after save bugs >> and I'm now completely out of ideas, other than to drop Core Data. >> >> In my model, I have EntityA, wich has an 1-many relationship to EntityB, >> which also have a 1-many relationship to EntityC. >> Both relationship are bi-directionnal, and I'm using cascade delete from A >> to C. >> >> The only object in that chain that seems to be deletable is EntityB. >> As soon as I try to delete an object from EntityC (A -> B -> C), I get this >> error: >> Terminating app due to uncaught exception 'NSObjectInaccessibleException', >> reason: 'CoreData could not fulfill a fault for >> >> I've been hitting this error for a long time now. I've read that it may be >> because I may have a reference in my code to the object that get deleted. So >> I cleaned up everything, nothing does. >> So out of despair, I've created a small method in my main window that >> creates a new tree of object (A contain 1 B, contains 1 C) and try to delete >> C. No references anywhere here. >> >> If I try deleting the C object before saving the new stuff, I get this error: >> Domain=NSCocoaErrorDomain Code=134030 "The operation couldn’t be completed. >> (Cocoa error 134030.) >> NSUnderlyingException = "Cannot update object that was never inserted."; >> >> And if I save, then delete then save again I get back to the >> NSObjectInaccessibleException. >> >> >> Anybody, please, if you have a pointer so that I could find and fix this >> error... It does not make sense that such a library fails with such a >> trivial case. >> I must be doing something wrong, but I've re-re-re check everything and >> don't see. >> >> I've played with the reverse relationship delete rules, made all of the >> optional, put them to nil before saving, nothing does :( > > There may not be enough information here but I take a shot. Are you suing > only one managed object context? Multiple contexts do *not* automatically > sync, so if you don't handle this yourself you will run into similar > problems. Does C have any relationship to A? Is C loaded directly or through > B, and B likewise trough A? Or, if all objects are new, are you properly > adding each object to the relationship (that also doesn't happen > automatically, although properly bound NSArrayControllers will do this for > you)? > > HTH, > > Keary Suska > Esoteritech, Inc. > "Demystifying technology for your home or business" > Eric Giguere eric.gigu...@videotron.ca
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com