AddressBook:如何获取不同Exchange源的名称 [英] AddressBook: how to get names of different Exchange sources

查看:140
本文介绍了AddressBook:如何获取不同Exchange源的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取我的iPhone同步的所有Exchange来源的名称。对于例如如果我使用ActiveSync Exchange将我的设备同步到Gmail和Hotmail帐户,在原生联系人中,我可以根据我设置的不同帐户看到不同的部分。当我尝试以编程方式执行相同操作时,我获得的唯一信息是sourceType(在两种情况下都是Exchange)和sourceName(在两种情况下都是Contacts)。我没办法区分哪个是Gmail联系人,哪个是Hotmail联系人。

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


}


推荐答案

你似乎不能在iOS中这样做(还)

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

这篇关于AddressBook:如何获取不同Exchange源的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆