The first deployment to an IOS device for my application is crashing as I'm getting a: "'no such table: Z_METADATA'" error. I have copied the SQLite file across from my device and opened it up in a SQLite browser and I see no tables in it.
It seems to occur in the code (I took from the Apple example) which sets up the database:
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataProjectTemplate.sqlite"];
[__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error] // Errors out here
And I get the error:
Unresolved error Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x1905e0 {NSFilePath=/var/mobile/Applications/543D2AA1-2484-4A6B-A694-DCD55B81E224/Documents/CoreDataProjectTemplate.sqlite, NSUnderlyingException=I/O error for database at /var/mobile/Applications/543D2AA1-2484-4A6B-A694-DCD55B81E224/Documents/CoreDataProjectTemplate.sqlite. SQLite error code:1, 'no such table: Z_METADATA'}, {
NSFilePath = "/var/mobile/Applications/543D2AA1-2484-4A6B-A694-DCD55B81E224/Documents/CoreDataProjectTemplate.sqlite";
NSUnderlyingException = "I/O error for database at /var/mobile/Applications/543D2AA1-2484-4A6B-A694-DCD55B81E224/Documents/CoreDataProjectTemplate.sqlite. SQLite error code:1, 'no such table: Z_METADATA'";
}
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.1 (8G4)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
So I guess my questions would include:
- How can I resolve this?
- Is the Apple code I'm using supposed to create the Z_METADATA table? (if so why isn't it there)
thanks
UPDATE: I tried manually deleting the sqlite file on the device and after this the application deployed fine. Do I perhaps just treat what happened as an anomaly perhaps?