Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an CFArrayRef to an NSMutableArray

This is my Code to create the CFArrayRef. I want to know how to make it to an NSMutableArray. I need it for my TableViewController. Or is there another way to use the CFArrayRef in the TableViewController?

ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef arrayOfAllPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
like image 823
Fabian Kröger Avatar asked Dec 10 '22 03:12

Fabian Kröger


1 Answers

A CFArrayRef is toll-free bridged to NSArray *, so you can cast it as such and then create a mutable copy:

NSMutableArray *data = [(NSArray *) myCFArrayRef mutableCopy];
like image 164
mipadi Avatar answered Jan 02 '23 07:01

mipadi