Irshad Ahmad
Irshad Ahmad

Reputation: 1383

i want to get the core data object based on object ID

i have a Message entity when i fetch the particular item based on objectID

i use this to access but it's showing error

let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.managedObjectContext.objectWithID(objectID

Upvotes: 0

Views: 213

Answers (1)

user8220947
user8220947

Reputation:

Try this

do {
   let message = try managedObjectContext.objectWithID(objectID)
}catch let err{
  print(err)
}

Upvotes: 1

Related Questions