Core Data SQLite store appears corrupted only when using migratePersistentStore
Core Data SQLite store appears corrupted only when using migratePersistentStore
- Subject: Core Data SQLite store appears corrupted only when using migratePersistentStore
- From: Dave Fernandes <email@hidden>
- Date: Sun, 6 Jan 2008 13:45:33 -0500
I am trying to migrate a persistent store from SQLite to binary type.
The SQLite store seems to be working OK -- I can read, edit and write
files -- however, when I try to migrate a know "good" file, I get an
error.
Here is the code snippet to migrate NSPersistentDocument *doc:
NSPersistentStoreCoordinator* psc = [[doc managedObjectContext]
persistentStoreCoordinator];
id oldStore = [psc persistentStoreForURL:[doc fileURL]];
NSError* error = nil;
[psc migratePersistentStore:oldStore toURL:newURL
options:nil withType:LIBRARY_STORE_TYPE error:&error];
The console message I get is the following:
2008-01-06 13:25:42.755 MyApp[1331] Fetch instances of entity
(NSEntityDescription) name Analysis, managedObjectClassName Analysis,
isAbstract 1, superentity name (null), properties {
...<many lines deleted here>...
}, subentities {
...<many lines deleted here>...
}, userInfo {} from store <NSSQLCore: 0x1632b510> failed, reason:
NSError "The file could not be opened because it is not in the right
format." Domain=NSCocoaErrorDomain Code=259 UserInfo={
NSUnderlyingException = Fatal error. The database at /Users/
davef/Library/Application Support/MyApp/Library.nlib is corrupted.
SQLite error code:1;
}
Can anyone shed some light on why the file only appears to be
corrupted when I try to migrate it?
Thanks in advance,
Dave Fernandes
_______________________________________________
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