In ios8, I would like to access the properties of a contact if it has more than one phone number, but I donβt know how to do it in iOS8.
Here is my code in iOS7:
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{ //If person has just one phone number ABMultiValueRef phonesRef = ABRecordCopyValue(person, kABPersonPhoneProperty); if(ABMultiValueGetCount(phonesRef) == 1){ CPIContact* contact = [self getCPIContactFromPerson:person andPhoneIndex:0]; [self addContact:contact]; // Dismiss the address book view controller. [_addressBookController dismissViewControllerAnimated:YES completion:nil]; return NO; }else if(ABMultiValueGetCount(phonesRef) == 0){ [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Common_information",nil) message:NSLocalizedString(@"EditCallSMS_noNumber", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"Common_ok",nil) otherButtonTitles:nil] show]; return NO; } else{ return YES; } }
I know that I need to use the didSelectPerson method from iOS8, but I do not know how to tell the application that it can continue after selecting a person, as in iOS7.
I read about predicateForSelectionOfPerson on Apple documentation, but I don't understand how to use it.
https://developer.apple.com/library/ios/documentation/AddressBookUI/Reference/ABPeoplePickerNavigationController_Class/index.html#//apple_ref/occ/instp/ABPeoplePickerNavigationController/predicateForSelectionOfProperty
Thank you in advance for your help.
Leep source share