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

 Xcode4.2编译问题

 
 

转载于:https://blog.51cto.com/ilifecycle/699314

相关文章:

  • 2021-10-04
  • 2021-10-19
  • 2021-09-08
  • 2021-10-18
  • 2021-07-11
  • 2021-05-30
  • 2021-09-05
  • 2021-09-09
猜你喜欢
  • 2022-02-10
  • 2021-11-30
  • 2021-04-04
  • 2021-03-31
  • 2021-10-07
  • 2021-06-28
  • 2021-06-25
相关资源
相似解决方案