XCode 5 Semantic Issue: ‘NSAutoreleasePool’ is unavailable: not available in automatic reference counting mode

Whenever a new Xcode release and iOs version comes out, there is a lot of new adjustments to make. Apple make a lot of change that are a real pain at the start, but generally make sense after a while.

With Xcode 5, apple have added ARC (automatic reference counting) when you compile the application. This breaks a lot of the old way of doing things, such as release, autorelease, and using NSAutoreleasePool.

So if we have code such as this:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[pool release];

We will get an error. But all we need to do is change the format of the code to this:

@autoreleasepool {

Or you can switch of ARC by setting CLANG_ENABLE_OBJC_ARC to NO in the Build Settings of your app.Screen Shot 2013-09-26 at 9.34.12 AM

You can read more about ARC here https://developer.apple.com/library/ios/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>