Fra*_*kZp 66 sqlite core-data ios uimanageddocument ios7
我正准备更新基于Core Data的应用程序以修复iOS 7.我使用Xcode 5和iOS 7 SDK GM.但是我意识到持久性存储的不同行为(即a UIManagedDocument):在iOS 7构建之前,persistentStore文档文件夹中只有一个文件(有时还有第二个文件persistentStore-journal).
在iOS 7构建(干净安装)中,持久性存储现在有三个文件:
persistentStorepersistentStore-wal 和persistentStore-shmApple现在默认将日志模式更改为WAL吗?我想知道我的应用程序是否有影响(想想用户如何从上一版本更新)?是否最好禁用WAL - 如果是这样,我怎么能用iOS 7/UIManagedDocument?
小智 96
是的,Apple已将默认日志模式更改为iOS7的WAL.您可以通过在调用addPersistentStoreWithType:configuration:url:options:error时将NSSQLitePragmasOption添加到选项来指定日志模式.例如,设置以前的DELETE默认模式:
NSDictionary *options = @{ NSSQLitePragmasOption : @{@"journal_mode" : @"DELETE"} };
Run Code Online (Sandbox Code Playgroud)
根据我的经验,WAL提供了更好的性能,但也看到这篇文章:
iOS CoreData - 启用sqlite WAL/Write-Ahead Logging有任何缺点