【发布时间】:2014-09-25 15:56:21
【问题描述】:
在 ios8 中,如果他有多个电话号码,我想访问联系人属性,但我不知道如何在 iOS8 中进行。
这是我在 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;
}
}
我知道我必须使用 iOS8 中的 didSelectPerson 方法,但我不知道如何告诉应用程序在选择 iOS7 中的人后可以继续。
我在苹果文档上阅读了 predicateForSelectionOfPerson 的内容,但我不明白如何使用它。
提前感谢您的帮助。
【问题讨论】:
标签: ios ios8 abpeoplepickerview