AddressBook: how to get names of different Exchange sources

时间秒杀一切 提交于 2019-12-06 06:43:47

问题


I want to get the name of all the Exchange sources that my iPhone is synced to. For e.g. if I sync my device to Gmail and Hotmail accounts using ActiveSync Exchange, in the native contacts, I can see different sections based on the different accounts that I have setup. When I try to programmatically do the same, the only information I get is sourceType (which is Exchange in both cases) and sourceName (which is "Contacts" in both cases). There's no way for me to differentiate which is the Gmail "Contacts" and which is the Hotmail "Contacts".

Anyone know how to do this? Here's my code:

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


}

回答1:


You can't do this in iOS it seems (yet)



来源:https://stackoverflow.com/questions/5609690/addressbook-how-to-get-names-of-different-exchange-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!