在使用 XCode 编译和运行项目时,Core Data
我遇到了一个我以前从未见过的错误:
2013-09-12 16:59:10.156 myapp[57811:70b] CoreData: error:
(14) I/O error for database at /Users/administrador/Library/
Application Support/iPhone Simulator/7.0/Applications/
6BA67336-B093-46CF-8B11-E3595409DAC2/myapp.app/database.sqlite.
SQLite error code:14, 'unable to open database file'
生成此消息的代码是:
psc = [[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel:self.managedObjectModel];
NSURL *storeURL = [[NSBundle mainBundle]
URLForResource:@"database" withExtension:@"sqlite"];
[psc addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil URL:storeURL
options:@{NSReadOnlyPersistentStoreOption : @YES} error:NULL];
我试过Build->Clean
了,删除派生数据,卸载应用程序。
我在发布之前检查了这个问题,我相信问题是不同的。
注意: sqlite 是应用程序的资源
建议使用调试的信息
2013-09-12 17:43:38.341 myapp[58322:70b] CoreData: annotation: Connecting to sqlite database file at "/Users/administrador/Library/Application Support/iPhone Simulator/7.0/Applications/6BA67336-B093-46CF-8B11-E3595409DAC2/myapp.app/database.sqlite"
2013-09-12 17:43:38.360 myapp[58322:70b] CoreData: sql: SELECT Z_VERSION, Z_UUID, Z_PLIST FROM Z_METADATA
2013-09-12 17:43:38.363 myapp[58322:70b] CoreData: annotation: Disconnecting from sqlite database due to an error.
2013-09-12 17:43:38.364 myapp[58322:70b] CoreData: error: (14) I/O error for database at /Users/administrador/Library/Application Support/iPhone Simulator/7.0/Applications/6BA67336-B093-46CF-8B11-E3595409DAC2/myapp.app/database.sqlite. SQLite error code:14, 'unable to open database file'
2013-09-12 17:43:38.366 myapp[58322:70b] CoreData: annotation: Disconnecting from sqlite database.