0
我創建了一個NSPersistentContainer來保存一些數據,但即使在上下文中調用save()
也不會創建任何數據庫文件。NSPersistentContainer不創建數據庫文件
我使用的用於創建NSPersistentContainer的代碼是:
let container = NSPersistentContainer(name: "Model")
let description = NSPersistentStoreDescription()
description.shouldInferMappingModelAutomatically = true
description.shouldMigrateStoreAutomatically = true
container.persistentStoreDescriptions = [description]
container.loadPersistentStores { ... }