ABSource名称返回nil [英] ABSource name returning nil

查看:99
本文介绍了ABSource名称返回nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取ABSource对象的名称?使用以下代码,名称返回nil。

How do I get the name of an ABSource object? Using the following code, the name returns nil.

ABAddressBookRef addressBook = ABAddressBookCreate();
for (id object in [(NSArray *)ABAddressBookCopyArrayOfAllSources(addressBook) autorelease]) {
    ABRecordRef source = (ABRecordRef)object;
    NSString *sourceTypeName = (NSString *)((CFStringRef)ABRecordCopyValue(source, kABSourceNameProperty));
    NSLog(@"name: %@", sourceTypeName);
}
CFRelease(addressBook);


推荐答案

在这里,您有一个示例代码来检索ABSource和ABSourceType。

Here, you have an example of code to retrieve ABSource and ABSourceType.

这篇关于ABSource名称返回nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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