I am using ABPeoplePickerNavigationController
for representation table of contacts. By tapping contact I need to set new image for it. I added code to delegate for changing person data, but can't change image. Any suggestions?
This is my code below:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
NSData *dataRef = UIImagePNGRepresentation(self.theImage);
CFDataRef cfdata = CFDataCreate(NULL, [dataRef bytes], [dataRef length]);
CFErrorRef error;
ABPersonRemoveImageData(person, &error); // clean any image first from ref
if (ABAddressBookSave(_addressBook, &error))
{
ABPersonSetImageData(person, cfdata, &error);
ABAddressBookSave(_addressBook, &error);
}
CFRelease(cfdata);
[self dismissViewControllerAnimated:YES completion:nil];
return NO;
}
I downloaded sample from here: link
To check how it works you can download code and modify delegate below with my code.