2

I load a contacts picture from the address book using the following code:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{

    UIImage *image = [UIImage imageWithData:(NSData *)ABPersonCopyImageData(person)];

    return NO;
}

However, this code returns the full image that is stored rather than the cropped version, that is shown in various places, like the Addressbook.

Besi
  • 22,579
  • 24
  • 131
  • 223
  • possible duplicate of [Get image of a person from AddressBook](http://stackoverflow.com/questions/2085959/get-image-of-a-person-from-addressbook) – Besi Jan 23 '12 at 14:05

1 Answers1

4

I found the answer here: https://stackoverflow.com/a/6953492/784318

NSData *imageData = (__bridge NSData*)ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail);
UIImage *image = [UIImage imageWithData:imageData];
Community
  • 1
  • 1
Besi
  • 22,579
  • 24
  • 131
  • 223