-[NSManagedObjectContext save:] fails but gives no NSError
-[NSManagedObjectContext save:] fails but gives no NSError
- Subject: -[NSManagedObjectContext save:] fails but gives no NSError
- From: Jerry Krinock <email@hidden>
- Date: Wed, 21 Nov 2007 19:34:38 -0800
The following code snippet -saves an NSManagedObjectContext and logs
debugging info:
NSLog(@"11499 moc %x has %d insertedObjects",
[self managedObjectContext],
[[[self managedObjectContext] insertedObjects] count]) ;
NSLog(@"11876 Before saving, &error = %x", &error) ;
BOOL savedOK = [[self managedObjectContext] save:&error] ;
NSLog(@"11935 savedOK = %d", savedOK) ;
NSLog(@"12500 NSError saving = %@", error) ;
Gives me this:
11499 moc 15a630e0 has 1281 insertedObjects
11876 Before saving, &error = bfffef9c
11935 savedOK = 0
12500 NSError saving = (null)
Examining the store's xml file shows that indeed the save operation
failed. Its file modification time is 24 hours ago. But, darn, the
moc didn't set any NSError.
The problem is apparently some corruption in that xml file, because if
I delete that file and re-run, everything works fine. However, other
than a few force-quits, I have not done anything in the last 24 hours
which should have corrupted the file. I have not made any changes to
the data model or schema.
I can't see anything wrong in the apparently-corrupt file. Comparing
it file with the newly-created one that works, the <metadata> is the
same and the <databaseInfo> is the same except for different <UUID>
and <nextObjectID>, but these differences seem to be expected.
Anyone know what the unreported error might be? I now believe that
this also happened about a week ago, and I'm worried that some user
operation might corrupt the file as I apparently did.
Jerry Krinock
_______________________________________________
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