NSAutoreleasePool' is unavailable: not available in automatic reference counting mode

 

这我就纠结了,对着书敲都出问题,这让我怎么学啊,结果google了下发现原来我用的是X-code 4.2,苹果引入了自动记算引用数的功能,所以老的项目中

NSAutoreleasePool  * pool = [[NSAutoreleasePool allocinit];是报错的,必须把arc(auto-reference-command)关闭才行,方法如下:

Build settings--->Apple LLVM compiler 3.0- Language--->Objective-C Automatic Reference Counting 将YES改为NO。

如果是ios5 需要在main的头部引入 #import "AppDelegate.h" 才可以解决。

相关文章:

  • 2021-04-12
  • 2021-05-28
  • 2021-07-02
  • 2021-06-22
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2021-08-22
  • 2021-12-30
相关资源
相似解决方案