Guest User

Untitled

a guest
Apr 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <Owner>
  2. <Name>alexpreynolds</Name>
  3. <ID>123456</ID>
  4. </Owner>
  5. <Books>
  6. <Book>Book One</Book>
  7. <Book>Book Two</Book>
  8. ...
  9. <Book>Book N</Book>
  10. </Books>
  11.  
  12. *** Terminating app due to uncaught
  13. exception 'NSInvalidArgumentException',
  14. reason: 'Illegal attempt to establish a
  15. relationship 'owner' between objects in
  16. different contexts
  17.  
  18. (source = <Book: 0x7803590>
  19. (entity: Book; id: 0x7802ae0 <x-coredata:///
  20. Book/t527F06B2-3EB5-47CF-9A29-985B0D3758862>
  21. ; data: {
  22. creationDate = 2009-10-12 06:01:53 -0700;
  23. name = nil;
  24. nameInitial = nil;
  25. operations = (
  26. );
  27. owner = nil;
  28. type = 0;
  29. }) ,
  30.  
  31. destination = <Owner: 0x78020a0> (entity:
  32. Owner; id: 0x3a56f80 <x-coredata://043AF2F0-1AD0-
  33. 4078-A5E8-E9D7071D67D1/Owner/p1> ; data: {
  34. books = "<relationship fault: 0x7801bf0 'books'>";
  35. displayName = alexpreynolds;
  36. ownerID = 123456;
  37. }))'
  38.  
  39. NSManagedObject *book = // get a book in one MOC
  40. NSManagedObject *owner = // get an owner in a different MOC
  41. [[owner mutableSetValueForKey:@"books"] addObject:[owner managedObjectContext:objectWithID:[book objectID]]];
Add Comment
Please, Sign In to add comment