0
我正在學習使用CoreData創建iOS數據庫。我創建了示例應用程序來了解CoreData.I從默認數據庫創建目錄中提取Sqlite文件,以使用SQLite瀏覽器檢查數據。但DBBrowser什麼也沒有顯示,但成功顯示消息並從數據庫中檢索數據。然後,我發現有關CoreData數據庫模式的this.I found 更改WAL模式的解決方案。之後,我運行,再次在數據庫目錄中創建WAL模式數據庫。我不明白我的代碼發生了什麼錯誤。任何人都提供解決方案如何使用swift在iOS coredata sqlite中啓用DELETE MODE
的Xcode版本:6.3
的iOS SDK:8.3
CODE
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
var options = Dictionary<NSObject, AnyObject>()
options[NSMigratePersistentStoresAutomaticallyOption] = true
options[NSInferMappingModelAutomaticallyOption] = true
options["journal_mode"] = "DELETE"
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("CoreDartaDemo.sqlite")
var error: NSError? = nil
var failureReason = "There was an error creating or loading the application's saved data."
if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: options, error: &error) == nil
{
error report
}
return coordinator
}()