I want to get the contact name, photos from the Addressbook in my iphone application. I can get the contacts and store in array.but now I know how to also get the photos.the contacts the code that I use is as follows.
ABAddressBookRef ab=ABAddressBookCreate();
NSArray *arrTemp=(NSArray *)ABAddressBookCopyArrayOfAllPeople(ab);
arrContact=[[NSMutableArray alloc] init];
for (int i=0;i<[arrTemp count];i++)
{
NSMutableDictionary *dicContact=[[NSMutableDictionary alloc] init];
NSString *str=(NSString *) ABRecordCopyValue([arrTemp objectAtIndex:i], kABPersonFirstNameProperty);
@try
{
[dicContact setObject:str forKey:@"name"];
}
@catch (NSException * e) {
[dicContact release];
continue;
}
[arrContact addObject:dicContact];
NSLog(@"mohit inside the loop");
[dicContact release];
}
I want to get the photo and the name of the contacts in this array (arrContacts), and then display them in a table. Please give me a guide. thank
source
share