【发布时间】:2016-07-12 21:26:58
【问题描述】:
我的变量entityDescription 似乎为零,所以我在编译时遇到了致命错误。有谁知道解决方案? persistentContainer 在同一个类 (AppDelegate) 中声明。
let entityDescription = NSEntityDescription.entity(forEntityName: "Person", in: self.persistentContainer.viewContext)
let newPerson = NSManagedObject(entity: entityDescription!, insertInto: self.persistentContainer.viewContext)
newPerson.setValue("Thomas", forKey: "first")
【问题讨论】:
标签: ios swift core-data swift3