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

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

For an autoreleased version, use

NSMutableArray* data = [NSMutableArray arrayWithArray: (NSArray*) myCFArrayRef];

Need Your Help

PostgreSQL Check Constraint if concerned column is nullable

sql postgresql database-design check-constraints

I have the sample table definition below. Is it possible to create a check constraint wherein the column affected can be nullable?

Is there a function in ORACLE PL/SQL to calculate the area of a polygon?

oracle plsql polygon polygons oracle-spatial

A polygon in terms of oracle spatial data (SDO_GEOMETRY). The polygon is formed by geographic coordinates and can be irregular.