Before ARC was introduced you had to manually retain/release/autorelease objects to ensure they would exist for as long as you needed them. Forgetting to send retain to an object, or releasing it too many times would cause your app to leak memory or crash.

A good overview of ARC:


Turning on ARC for an old project which didn't previously use it

Select the project in the left window then select your project in "Targets" and then select the "Build Settings" tab.

In the section "Build Options"

Ensure "Compiler for C/C++/Objective-C" is set to "Apple LLVM #.#"

In the Section "Apple LLVM #.# – Language – Objective C"

Objective C Automatic Reference Counting = YES


When you compile you will get some or all of these issues to fix in the code:

main() function, comment these out:

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

[pool release];

Delete all release statements:

[ObjectName release]

Delete any -(void)dealloc methods

[super dealloc];

Error "existing instance variable 'delegate' for unsafe_unretained property 'delegate' must be __unsafe_unretained"

As the compiler suggests add the __unsafe_unretained:


__unsafe_unretained id <GotServerVersionDelegate> delegate;