首页 > 技术文章 > 'release' is unavailable: not available in automatic reference counting mode..(Xcode4.2.1+iOS5.0)

cc-Cheng 2013-09-26 10:53 原文

在网上看到两种解决办法:

第一种:设置自动引用计数关闭

You need to turn off Automatic Reference Counting. You do this by clicking on your project in the navigator (the top item in the finder-like thing on the left), then click on your target, select "Build Settings" and turn off the option "Objective-C Automatic Reference Counting" (you can use the search field on the upper right to search it).

http://blog.csdn.net/duanyipeng/article/details/7108200

第二种:去掉autorelease

Remove all retain release autorelease NSAutoReleasePools and retainCount calls, since ARC makes them for you. With the exception of NSAutoReleasePools They have been replaced by @autorelease{}.

Change

SBJSON *json4 = [[SBJSON new] autorelease];

to

SBJSON *json4 = [SBJSON new];

http://stackoverflow.com/questions/6363566/im-getting-this-error-autorelease-is-unavailable-not-available-in-automatic-r

http://stackoverflow.com/questions/8236797/xcode-cocoa-release-is-unavailable-error

推荐阅读