Advertisement
Guest User

Untitled

a guest
Oct 14th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Gott some info from the server
  2. NSMutableArray *serverContacts
  3. for(NSDictionary *jsonContact in contactsFromServer){
  4.     Contact *myContact = [Method to convert jsonContact to a "Contact" object];
  5.     [serverContacts addObject: myContact];
  6. }
  7.  
  8. NSFetchRequest *blabla;
  9. NSArray *results = // execute request, returns an array of "Contact" objects as well
  10.  
  11. for(Contact *contact in results){
  12.     contact.firstName = "blablabla"; // Update some field
  13. }
  14.  
  15. [managedObjectContext save]; // Save context, would save the updates, but also insert all of the objects from the "serverContacts" array which I just wanted as regular objects for reference and never wanted to insert them.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement