我用下面的代碼顯示在我的應用程序的聯繫人列表:避免CNContactPickerViewController顯示電子郵件
self.contactPicker = [[CNContactPickerViewController alloc] init];
self.contactPicker.delegate = self;
self.contactPicker.predicateForSelectionOfContact =
[NSPredicate predicateWithFormat:@"TRUEPREDICATE"];
[viewController presentViewController:self.contactPicker
animated:YES
completion:nil
];
頁面顯示所有聯繫人包括電子郵件。我只想顯示數字(並且沒有電子郵件)NSPredicate
或CNContactPickerViewController
本身上是否有任何選項僅顯示數字?
我也用過:
self.contactPicker.displayedPropertyKeys = @[@"phoneNumber"];
但它不是工作壓力太大。
請參閱我的編輯 –
它應該是'self.contactPicker.displayedPropertyKeys = @ [@「phoneNumbers」];'。它應該堅持在'CNContact' –
中聲明的密鑰,我用「phoneNumbers」替換了「phonenumber」,但它仍然會顯示電子郵件 –