How to create CFArrayRef

I am trying to convert only one iPhone contact to vCard using the built-in methods. The docs say use:

ABPersonCreateVCardRepresentationWithPeople(CFArrayRef people) 

... but my delegate method gives me the following:

 - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person; 

I cannot figure out how to create a CFArrayRef with just one ABRecordRef .

The docs pointed me to CFArrayCreate() , which confused me even more. I don't know enough C to figure it out on my own. I read at SO that NSArray had something called a duty free bridge and should be interchangeable with CFArrayRef , but didn't quite understand how to use it, since the compiler complained when I tried to just replace them.

+6
source share
1 answer

free bridge:

where array is the type of class: NSArray

 CFArrayRef arrayRef = (__bridge CFArrayRef)array; 
+12
source

Source: https://habr.com/ru/post/920476/


All Articles