title: How to save image to iphone's AddressBook using SDK API?
body: <p>My purpose is to process one image from image library, and save this image directly to one person record (i,e, "Tom" ), which is selected from AddressBook, I can see the new image replace Tom's previous image, but I can not save it to AddressBook.</p>
  
  <p>I implemented delegate ABPeoplePickerNavigationControllerDelegate, and using following logics, but whatever I tried, modified records can not be saved to address books.</p>
  
  <p>Any clues or suggest ? Thanks</p>
  
  <pre><code>    ABAddressBookRef addressBook= ABAddressBookCreate();
      CFErrorRef error = NULL;
      BOOL wantToSaveChanges = YES;
  
      ABRecordSetValue(person, kABPersonFirstNameProperty, @"Shi", &amp;error);//, &amp;error)
  
      NSData * dataRef = UIImagePNGRepresentation(cellImage);
      ABPersonSetImageData(person, dataRef, &amp;error);
  
      if (ABAddressBookHasUnsavedChanges(addressBook)) {\
          NSLog(@"need to save ");
          if (wantToSaveChanges) {
              ABAddressBookSave(addressBook, &amp;error);
          } else {
              ABAddressBookRevert(addressBook);
          }
      }else {
          NSLog(@"no changes");
      }
  
      if (error != NULL) {/*... Handle error. ...*/
          NSLog(@"error happened here " );
  
      }
  
      CFRelease(addressBook);
  </code></pre>