检查ABMultiValueRef是否没有值

我想检查我的用户的地址簿中的联系人是否有电话号码。 如果他这样做,我想在UITableView中显示该名称

我试图检查phoneNumbers != nil ,但这是行不通的。 这是我的整个代码:

 ABMultiValueRef phoneNumbers = ABRecordCopyValue(person, kABPersonPhoneProperty); if(phoneNumbers != nil){ [_numbers addObject:[NSString stringWithFormat:@"%@", phoneNumbers]]; } 

使用ABMultiValueGetCount来检查phoneNumbers是否有任何值。

基于问题的例子:

 ABMultiValueRef phoneNumbers = ABRecordCopyValue(person, kABPersonPhoneProperty); if(ABMultiValueGetCount(phoneNumbers)){ [_numbers addObject:[NSString stringWithFormat:@"%@", phoneNumbers]]; } 
Interesting Posts