Problem getting IM information from an ABRecord
Posted
by bend0r
on Stack Overflow
See other posts from Stack Overflow
or by bend0r
Published on 2010-03-26T08:43:41Z
Indexed on
2010/03/26
14:43 UTC
Read the original article
Hit count: 314
Hello, I'm trying to get the IM account information from existing contacts (adressbook) on iPhone. I walk through the contacts and I get the contacts which have an entry in IM but I can't read the 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);
}
}
what I'm doing wrong?
© Stack Overflow or respective owner