I developed one application. It is working perfectly in IOS 7. But IOS 8 I have issues. I implement the function get the contact information from address book.
So I implement the method
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
[self gettingContactInfo:person];
[self dismissViewControllerAnimated:YES completion:nil];
return NO;
}
This method is perfectly working in IOS 7. But IOS 8 not working.
So I developed other method
-(void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person{
[self gettingContactInfo:person];
[self dismissViewControllerAnimated:YES completion:nil];
}
But after this method I am always getting email is empty. What is the mistake i did?
Email getting method
_emailArray = [[NSMutableArray alloc]init];
ABMutableMultiValueRef emailsRef = ABRecordCopyValue(person, kABPersonEmailProperty);
if (ABMultiValueGetCount(emailsRef) > 0) {
// collect all emails in array
for (CFIndex i = 0; i < ABMultiValueGetCount(emailsRef); i++) {
CFStringRef emailRef = ABMultiValueCopyValueAtIndex(emailsRef, i);
NSString *currentEmail=(__bridge NSString *)emailRef;
NSLog(@"%@",currentEmail);
[_contactInfoDict setObject:currentEmail forKey:CONTACT_EMAIL];
[_emailArray addObject:currentEmail];
CFRelease(emailRef);
}
}
if (emailsRef) {
CFRelease(emailsRef);
}