NSPersistentDocument Save As failure
NSPersistentDocument Save As failure
- Subject: NSPersistentDocument Save As failure
- From: Yvan BARTHÉLEMY <email@hidden>
- Date: Wed, 29 Jul 2009 16:50:38 +0200
Hi,
I have some misunderestanding with Core Data documents. I'm creating an
empty Core Data document and then adding some content in it. I then saved it
successfully. The problem comes only when I'm using Save As. In one
document, I can add items (using my array controllers bound to my context),
then choose Save As without any hurt. In the other document, this fails.
This time the object is added programmatically the following way :
NSManagedObjectContext *context = [[self graphicsContainer]
managedObjectContext];
DSCanvasImage *image = [NSEntityDescription insertNewObjectForEntityForName
:@"Image" inManagedObjectContext:context];
[image setImage:[[NSImage alloc] initWithPasteboard:[sender
draggingPasteboard]]];
[[self graphicsContainer] addObject:image];
graphicsContainer is the arrayController bound to my view in which I call
the code.
On Saving I got the following error message, but it doesn't help me to find
the cause of my problem:
*Error: Error Domain=NSCocoaErrorDomain Code=134030 UserInfo=0xef20190 "An
error occurred while saving."*
*
*
Querying userInfo on this error gives me (got by overriding *
writeToURL:ofType:forSaveOperation:originalContentsURL:error:*):
*{*
* NSAffectedObjectsErrorKey = (*
* <DSCanvasImage: 0xef1d630> (entity: Image; id: 0x10ea4400
<x-coredata://B6C23E43-6210-44A2-BB1B-1139134E60F8/Image/t52C71CCB-C982-4EB1-9DED-07ABFF13CF9D6>
; data: <fault>)*
* );*
* NSUnderlyingException = Cannot update object that was never inserted.;*
*}*
Any information is welcome.
Thanks for helping.
Regards,
Yvan
_______________________________________________
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