2

I meet a problem that I can't detect the source type (ex:gmail ,yahoo or exchange account) in addressbook.

I use method ABAddressBookCopyArrayOfAllSources to get all the sources.

CFArrayRef allSources = ABAddressBookCopyArrayOfAllSources(book);
for (CFIndex i = 0; i < CFArrayGetCount(allSources); i++) {
    ABRecordRef source = (ABRecordRef)CFArrayGetValueAtIndex(allSources, i);
    NSString *sourceTypeName = (NSString *)((CFStringRef)ABRecordCopyValue(source, kABSourceNameProperty));
    NSLog(@"%@", sourceTypeName);
}

But the Gmail account source name is 'Address Book' (It's strange to me) iCloud account source name is 'Card' (also strange). the source type is cardav

I searched several similar questions:

1.AddressBook: Differentiating sources of type kABSourceTypeExchangeGAL

2.ABAddressBook ABSource and ABSourceType

the answers are you can't detect the account .

However, I downloaded a app named 'Cobook'. It can show my gmail account name.I'm very curious about how the app can do that.I did not found there is some api can get this info.

Thanks advance.

Community
  • 1
  • 1
frank
  • 1,978
  • 1
  • 15
  • 19

0 Answers0