Skip navigation.
 
mlCore Data SQLite store appears corrupted only when using migratePersistentStore
FROM : Dave Fernandes
DATE : Sun Jan 06 19:45:33 2008

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

Related mailsAuthorDate
mlCore Data SQLite store appears corrupted only when using migratePersistentStore Dave Fernandes Jan 6, 19:45
mlRe: Core Data SQLite store appears corrupted only when using migratePersistentStore Jim Correia Jan 6, 20:10
mlRe: Core Data SQLite store appears corrupted only when using migratePersistentStore Dave Fernandes Jan 6, 20:40
ml[SOLVED] Re: Core Data SQLite store appears corrupted only when using migratePersistentStore Dave Fernandes Jan 10, 01:44