我的应用程序首次部署到IOS设备时崩溃了,因为我得到了:“'没有这样的表:Z_METADATA'”错误。我已经从我的设备复制了SQLite文件,并在SQLite浏览器中打开它,我看不到其中的表格。
似乎发生在设置数据库的代码中(我从Apple示例中获取):
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataProjectTemplate.sqlite"];
[__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error] // Errors out here
我收到错误:
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).
所以我想我的问题包括:
感谢
更新:我尝试手动删除设备上的sqlite文件,之后应用程序部署正常。或许我或许只是将发生的事情视为异常?
答案 0 :(得分:0)
我尝试手动删除设备上的sqlite文件,之后应用程序部署正常。
(因此可能将此视为异常)