gpt4 book ai didi

ios - 如何仅启动具有手机号码的联系人的 ABPeoplePickerNavigationController?

转载 作者:行者123 更新时间:2023-11-29 10:30:40 26 4
gpt4 key购买 nike

Apple 提供了一个名为 PeoplePicker 的示例项目,它启动了一个仅包含具有电子邮件地址的联系人的 ABPeoplePickerNavigationController:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

// The people picker will only display the person's name, image and email properties in ABPersonViewController.
picker.displayedProperties = @[@(kABPersonEmailProperty)];

// The people picker will enable selection of persons that have at least one email address.
picker.predicateForEnablingPerson = [NSPredicate predicateWithFormat:@"emailAddresses.@count > 0"];

如何只显示有手机/电话号码的联系人?我已经翻遍了 Apple 文档以找到用于 @count 操作的 key (本例中为 emailAddresses),但我找不到它。

最佳答案

像这样使用 ABPersonPhoneNumbersProperty:

[NSPredicate predicateWithFormat:@"%K.@count > 0", ABPersonPhoneNumbersProperty];

关于ios - 如何仅启动具有手机号码的联系人的 ABPeoplePickerNavigationController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29839781/

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