NSPersistentContainer默认创建什么样的持久性存储?

时间:2017-10-05 22:34:30

标签: ios swift core-data

当我通过此代码自行创建容器时,应用程序支持文件夹中会创建哪种持久性存储?

private lazy var storeContainer: NSPersistentContainer = {
    let container = NSPersistentContainer(name: self.modelName)
    container.persistentStoreDescriptions = [self.storeDescription]
    container.loadPersistentStores { (storeDescription, error) in
        if let error = error {
            fatalError("Unresolved error \(error)")
        }
    }
    return container
}()

1 个答案:

答案 0 :(得分:1)

默认情况下,在iOS上,它会创建一个NSSQLiteStoreType的持久存储,并启用自动轻量级迁移。

参考:https://developer.apple.com/library/content/releasenotes/General/WhatNewCoreData2016/ReleaseNotes.html#//apple_ref/doc/uid/TP40017342-CH1-DontLinkElementID_3