我正在尝试访问kABPersonHomePageLabel。根据我的理解,我首先必须访问通过调用此属性kABPersonURLProperty生成的字典,如下所示。
当我NSloging web实例时,我得到以下日志:

2013-10-09 20:49:04.823 contacts[1303:907] _$!<HomePage>!$_

ABMultiValueRef websites = ABRecordCopyValue((__bridge ABRecordRef)record, kABPersonURLProperty);
if (ABMultiValueGetCount(websites) > 0) {
    NSLog(@"BBIIGGEERR");
    CFStringRef web = ABMultiValueCopyLabelAtIndex(websites,0);
    NSLog(@"%@",web);
}

我知道我在此特定联系人中有一个家庭网址,但是如何提取该网址?

最佳答案

您必须像这样搜索所有ABMultiValueRef值

更新

    ABMultiValueRef websites = ABRecordCopyValue((__bridge ABRecordRef)record, kABPersonURLProperty);
    NSUInteger i = 0;
    for (i = 0; i < ABMultiValueGetCount(websites); i++)
            {
                NSString *eml = (__bridge_transfer NSString *)ABMultiValueCopyLabelAtIndex(websites, i);
                if([eml isEqualToString:(NSString *) kABPersonHomePageLabel]) {
                    NSString *web = (__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(websites, i);
                    NSLog(@"%@",web);
                }
            }

关于ios - 从通讯录访问kABPersonURLProperty,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19289044/

10-12 05:01