When my sqlite database is created using the underlying data model, on this line:
if (![persistentStoreCoordinator_ addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
I get an error message:
NSUnderlyingException=I/O SQLite error code:1, 'no such table: Z_METADATA'
Any idea how to fix this? I tried for many days. The database is created and copied to the document directory on my device.
Note:
If I uninstall the application, rebuild and install it on my device, the .sqlite file is dated two days ago, and the .mom file is dated yesterday. Is the database not recreated at compile time if necessary? I do not have a .sqlite file in my project, just a .xcdatamodel.
Thank you for your time.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator_ != nil) { return persistentStoreCoordinator_; } NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [documentPaths objectAtIndex:0];
Bryan source share