如何使CFArrayRef成为NSMutableArray [英] How to make an CFArrayRef to an NSMutableArray

查看:160
本文介绍了如何使CFArrayRef成为NSMutableArray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我创建CFArrayRef的代码.我想知道如何使其成为NSMutableArray.我的TableViewController需要它.还是有另一种方法可以在TableViewController中使用CFArrayRef?

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

推荐答案

CFArrayRef是免费电话桥接到NSArray *,因此您可以将其强制转换为这样,然后创建可变副本:

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

这篇关于如何使CFArrayRef成为NSMutableArray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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