Ios 我想根据对象ID获取核心数据对象
当我基于objectID获取特定项时,我有一个消息实体 我使用它来访问,但它显示错误Ios 我想根据对象ID获取核心数据对象,ios,swift,core-data,Ios,Swift,Core Data,当我基于objectID获取特定项时,我有一个消息实体 我使用它来访问,但它显示错误 let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.managedObjectContext.objectWithID(objectID 试试这个 do { let message = try managedObjectContext.objectWithID(objectID) }catch let e
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.managedObjectContext.objectWithID(objectID
试试这个
do {
let message = try managedObjectContext.objectWithID(objectID)
}catch let err{
print(err)
}
什么错误?如果你想要一个答案,这很重要。你确定这个对象存在吗?