NSAutoreleasePool报错

错误信息:

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

 

错误原因:

阅读的书籍用的是老版本的Xcode,而自己使用的是Xcode5,新版本中苹果引入了自动记算引用数的功能,所以老的项目中

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" 才可以解决。

posted on 2014-05-02 08:50  orientwolf  阅读(62)  评论(0编辑  收藏  举报