我正在尝试从AddressBook
iOS 上的现有联系人获取即时消息帐户信息。我浏览了联系人,我得到了具有即时消息传递价值的联系人,但我无法读取 jabber-address。
abArray = (NSArray *)ABAddressBookCopyArrayOfAllPeople(ABAddressBookCreate());
for(int i=0 ; i<[abArray count];i++)
{
ABRecordRef record = [abArray objectAtIndex:i];
ABMutableMultiValueRef multi = ABRecordCopyValue(record, kABPersonInstantMessageProperty);
for(CFIndex x=0;x<ABMultiValueGetCount(multi);x++)
{
CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(multi, x);
CFStringRef jabber = CFDictionaryGetValue(dict, kABPersonInstantMessageServiceJabber);
if(CFDictionaryContainsKey(dict, kABPersonInstantMessageServiceJabber))
{
NSLog(@"yes");
}
else {
NSLog(@"no");
}
// only to make it possible to log to console
NSString *jaab = (NSString *)jabber;
NSLog(@"jabber adress: %@" , jaab);
}
CFRelease(dict);
}
}
我究竟做错了什么?