2

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

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);
}

我知道我在这个特定联系人中有一个主页 url,但我如何提取 url?

4

1 回答 1

2

您必须像这样搜索所有 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);
                }
            }
于 2013-10-10T07:07:18.753 回答