ABSource name returning nil

二次信任 提交于 2020-01-03 05:33:10

问题


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

回答1:


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



来源:https://stackoverflow.com/questions/5527905/absource-name-returning-nil

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