【发布时间】:2018-07-27 03:59:48
【问题描述】:
我正在关注 raywenderlich 的 Core Data 教程:Tutorial
我面临的问题是在这个 sn-p 代码中:
let entity = NSEntityDescription.entity(forEntityName: "Person", in: managedContext)!
let person = NSManagedObject(entity: entity,insertInto: managedContext)
实体值返回nil,应用程序崩溃。有没有什么我错过了,因为我已经尝试了 3-4 次但仍然是同样的问题
【问题讨论】:
-
与问题无关,但千万不要强制解包,至少你的应用不会崩溃。
-
在使用核心数据时还要检查数据故障..
标签: ios swift core-data nsmanagedobject