views:

20

answers:

1

Hi, I am new to Core Data. I fetch few objects into an NSMutableArray. Now I want to update an object with objectID x.

My question is: How do I get the objectId for an object? and then how do I perform updates on that particular object? (eg: change 'Name' attribute and save)

Thanks

A: 

You get the ID by calling [myObject objectID]. You can update and save a new value by calling your objects accessors like you would with any other object. Then to write the changes to the persistent store you do:

NSError *error;

   if (![managedObjectContext save:&error]) {
      // Handle the error.
   }
Toastor