在ios 7的iphone上调试sqlite作为持久化对象的coredata程序的时候报如下的错误:
Attempt to add read-only file at path file:///var/mobile/Applications/08AE857B-819A-463E-B9E8-20234BD44931/TestingHelper.app/TestingHelper.sqlite read/write. Adding it read-only instead. This will be a hard error in the future; you must specify the NSReadOnlyPersistentStoreOption.
解决方法:
将原来的代码
if (![_persistentStoreCoordinatoraddPersistentStoreWithType:NSSQLiteStoreTypeconfiguration:nilURL:storeURLoptions:nilerror:&error]) {
替换成:
NSDictionary *storeOptions = @{NSReadOnlyPersistentStoreOption : @YES};
if (![_persistentStoreCoordinatoraddPersistentStoreWithType:NSSQLiteStoreTypeconfiguration:nilURL:storeURLoptions:storeOptions error:&error]) {