AddressBook:如何获取不同 Exchange 源的名称

发布于 2024-10-31 06:44:36 字数 675 浏览 4 评论 0原文

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

有人知道该怎么做吗?这是我的代码:

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


}

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


}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉宸 2024-11-07 06:44:36

你似乎还不能在 iOS 中做到这一点

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文