[英]Changing NSPersistentStoreFileProtectionKey for persistent store manager on existing sqlite
在应用程序处于后台时调用 addPersistentStoreWithType 时,我的sqlite
文件有时不可用,并且收到此错误:
[Model createPersistentStoreCoordinatorWithStoreURL:] line 387 $ sqlite 加密状态 NSFileProtectionCompleteUntilFirstUserAuthentication 错误 : Error Domain=NSCocoaErrorDomain Code=256 “操作无法完成。(Cocoa 错误 256.)” UserInfo=0x1560e540 {NSUnderizationDelivery,DomainSQLException
我发现这是因为文件仍然受到保护(默认为NSFileProtectionCompleteUntilFirstUserAuthentication
因此在用户重新启动后第一次解锁设备后,受保护的数据可用)。 我觉得这不是正确的行为,因为我有大量的崩溃,而且我无法想象很多人在野外重新启动后仍然锁定他们的设备。
因此,我现在正在添加我的持久存储协调器,并像这样调整配置
NSDictionary *options = @{
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES,
NSPersistentStoreFileProtectionKey : NSFileProtectionNone
};
NSPersistentStoreFileProtectionKey
这会破坏 sqlite(/ 里面的数据)吗?NSFileProtectionNone
时是否看到安全问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.