gpt4 book ai didi

ios - 联系选择器不工作

转载 作者:行者123 更新时间:2023-11-29 12:30:45 25 4
gpt4 key购买 nike

当用户点击电话号码时,我想在标签上显示联系人号码。但是我的代码没有自动接听第一部电话。我正在使用这个

- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker  didSelectPerson:(ABRecordRef)person
{
[self getPeopleContactProperties:person:0];
}

- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
[self getPeopleContactProperties:person:identifier];
}

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker;
{
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)getPeopleContactProperties :(ABRecordRef)person :(ABMultiValueIdentifier)identifier
{
NSString *email;
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonPhoneProperty);
if (emails) {
CFIndex index;
if (identifier == 0) {
index = 0;
} else {
index = ABMultiValueGetIndexForIdentifier(emails, identifier);
}
email = (__bridge NSString *) ABMultiValueCopyValueAtIndex(emails,index);
}

resultlabel.text =email;
}

最佳答案

if ([peoplePicker respondsToSelector:@selector(setPredicateForSelectionOfPerson:)])
{
peoplePicker.predicateForSelectionOfPerson = [NSPredicate predicateWithFormat:@"%K.@count > 1", ABPersonPhoneNumbersProperty];
}

关于ios - 联系选择器不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27797196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com