Weird Core Data Saving Error -- Help!
Weird Core Data Saving Error -- Help!
- Subject: Weird Core Data Saving Error -- Help!
- From: Steve Cronin <email@hidden>
- Date: Tue, 14 Mar 2006 17:44:50 -0600
Folks;
I've been developing an app which uses Core Data and very happy with
CD until late last night.
When I do a 'save' a totally blank record is now being written into
the SQLite store.
This only happens on 1 entity.
I have a modest data model and everything else continues to work fine.
I've not had any problems with this entity before.
I have rebuilt the entity class header using XCode's code generating
capabilities.
I have restarted the machine, updated to latest security patch,
repaired permissions, and verified the disk.
I've blown away the .sql file and the app's .plist. (Making sure the
files are ACTUALLY deleted)
I cleaned all sources and did a fresh build --> no compiler warnings.
I've reduced the problem to the following code:
Entity *entity = [NSEntityDescription
insertNewObjectForEntityForName:@"Entity"
inManagedObjectContext:managedObjectContext];
[managedObjectContext assignObject:entity
toPersistentStore:localSQLStore];
[managedObjectContext processPendingChanges];
error = nil;
if ([managedObjectContext commitEditing]) {
if ([managedObjectContext save:&error]) {
if (error!=nil) {
NSLog(@"MOC Save Succeeded but non-nil ERROR = %@",error);
} else {
NSLog(@"Save -Success --> Enitity = %@",entity);
}
} else NSLog(@"MOC Save Failed: ERROR = :%@",error);
} else NSLog(@"MOC CommitEditing failed ");
In the log there is 'Success' followed by the entityDescription with
values assigned exactly as I expect them to be!
The notifications that arise from an insert event all fire but no
objects are retrieved (as would be normal).
If I immediately quit the application and use SQLite Manager to query
the database, it shows a record count for entity but only retrieves a
blank row. BTW: There are mandatory attributes in the entity.
If I look at the .sql file with a text editor before and after the
method above, I see that the .sql file is modified with data that
bears some resemblance to the entity data above. (There are binary
attributes..)
So I'm thinking:
-- the datamodel is hosed up? How would I fix THAT? How would I
verify that?
-- sqlite.exe has been hammered? How do I do a re-install of that?
I don't really think so but I'm beginning to reach....
-- I haven't rebuilt the entity.m file because that's where a lot of
code is buried but that's what I'm going to start doing now.
Does ANYBODY have ANY suggestions/
As Murphy is want to do, this comes in the closing days before
release and I've got WAY to much to do to be out in the weeds with
this one!
Thanks All,
Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden