Automatic Reference Counting
One thing to note is that ARC is only partially supported on iOS 4.x. Specifically,
weak references are not supported, so you have to use
__unsafe_unretained to prevent retain cycles (similar to how you'd use
assign for a parent/child relationship).
If you're on iOS 5, then you get the full power of and
weak (which is a zeroing weak pointer).
// (Non-arc, weak delegate reference) @property (nonatomic, assign) id<SomeProtocol> delegate; // (ARC on iOS 4) @property (nonatomic, __unsafe_unretained) id<SomeProtocol> delegate; // (ARC on iOS 5) @property (nonatomic, weak) id<SomeProtocol> delegate;
Combining ARC & non-ARC files
Click on your project, click on Build Phases, then expand Compile Sources. Once you've found the files that you need to modify, double click on the compiler flags field and enter:
-fobjc-arcif you want to enable ARC for these files in a project where ARC is not the default
-fno-objc-arcif you want to disable ARC for these files in a project where ARC is the default