好的,这是答案:
首先,只使用你想要选择的属性displayedPropertyKeys
(在这种情况下CNContactPhoneNumbersKey
),并确保实现所有委托方法(即两者didSelectContact
- 当联系人只有一个电话号码时,didSelectContactProperty
- 当联系人有不止一个电话号码).
此外,通过设置限制联系人选择:
contactPicker.predicateForEnablingContact = [NSPredicate predicateWithFormat:@"phoneNumbers.@count > 0"]; contactPicker.predicateForSelectionOfContact = [NSPredicate predicateWithFormat:@"phoneNumbers.@count == 1"]; contactPicker.predicateForSelectionOfProperty = [NSPredicate predicateWithFormat:@"key == 'phoneNumbers'"];