当前位置:编程学习 > wap >>

ios5 xcode 4.2 中 release显示编译警告或错误的解决方法

  由于 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即可。

ios5 xcode 4.2 中 release 显示编译警告或错误的解决方法

 

作者“liyoro”
 

补充:移动开发 , IOS ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,