Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. let mediaEntity = NSEntityDescription.entity(forEntityName:
  2. "Media", in: managedContext)
  3. mediaEntity?.setValue(showMediaModel.popularity, forKey: "popularity")
  4. mediaEntity?.setValue(showMediaModel.title, forKey: "title")
  5. mediaEntity?.setValue(showMediaModel.type.rawValue, forKey: "type")
  6. mediaEntity?.setValue(showMediaModel.id, forKey: "id")
  7.  
  8. do {
  9. try managedContext.save()
  10. } catch let error as NSError {
  11. print("Could not save. (error), (error.userInfo)")
  12. }
  13.  
  14. Terminating app due to uncaught exception 'NSUnknownKeyException',
  15. reason: '[<NSEntityDescription 0x6000008c02c0>
  16. setValue:forUndefinedKey:]: this class is not key value coding-
  17. compliant for the key popularity.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement