How to resolve the error "there is no such table: Z_METADATA" for the first deployment on an iOS device

The first deployment on an iOS device for my application fails because I get the message: "There is no such table: Z_METADATA". I copied the SQLite file from my device and opened it in the SQLite browser, and I do not see tables in it.

This seems to be happening in the code (I took from an Apple example) that installs 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 message:

 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 think my questions will include:

  • How can i solve this?
  • Is the Apple code that I use should create a Z_METADATA table? (if so, why is it not)

thanks

UPDATE: I tried to manually delete the sqlite file on the device, after which the application was deployed in order. Maybe I'm just treating what happened as an anomaly?

+6
source share
1 answer

I tried to manually delete the sqlite file on the device, after which the application was deployed in order.

(This is probably why we consider this as an anomaly)

0
source

Source: https://habr.com/ru/post/885581/


All Articles