您的位置:首页 > 大数据 > 人工智能

Xcode4.2不能使用 release ,retainCount, retain的解决办法

2012-02-23 14:10 274 查看
由于
iOS5 xcode4.2 引入了ARC (AutomicReferenceCounting) , 使用xcode4.2 新建项目时,会有一些小小的变化。

NSAutoReleasePool
被 @ {Autoreleasepool / / Code for autoreleasepool } block 取代了。

新增了__strong , __weak 编译指令。

ios5.0知道你的变量在何时需要release,何时需要autorelease,所以变量不要写成全局的,全局的变量用single去代替。

解决办法:在项目中关闭
ARC 功能,在项目属性中将Object-C Automatic Reference Counting设置为NO即可。否则在编译时,会对 release ,retainCount, retain 等内存相关操作在编译时出现红色警告。

如下图:设置为No即可。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: