我有这个属性国家
它有一个属性State,类型是String,但应该是Int
所以我创建了一个新的数据模型版本(勾选了绿色标记)
我还将此代码添加到 persistentContainer:
let container = NSPersistentContainer(name: "Exchange")
let description = NSPersistentStoreDescription()
description.shouldMigrateStoreAutomatically = true
description.shouldInferMappingModelAutomatically = true
container.persistentStoreDescriptions = [description]
但是当我更新应用时 - 它崩溃了:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't create support directory (can't create directory)'
据我了解 - 从 String 到 Int 的自动迁移是造成这种情况的原因...
我该如何解决? 我需要手动迁移吗?
谢谢!
最佳答案
关于ios - xcode 10 - 核心数据迁移 String 到 Int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55245233/