Robbie Hanson edited this page Aug 23, 2013 · 3 revisions

Automatic Reference Counting (ARC) is an amazing new technology. It makes life easier for developers and speeds up your code at the same time. However, since it's such a radical change, it requires some new tools (Xcode 4.2+, Apple LLVM 3.0+ compiler) and some code changes (remove retain/release/autorelease, etc). This leaves library developers in a tough position: To ARC, or not to ARC? If the library is converted to ARC, those who haven't converted their apps will complain. If the library isn't converted to ARC, those who have converted their apps will complain! What to do?

One possibility is to maintain 2 branches: arc & non-arc. These would have to be kept in sync for every new commit and every push. Obviously this is a large burden (not to mention complications surrounding tagging). And library developers, especially those who actively develop and improve their libraries, don't consider this a solution. So ultimately, a decision must be made.

I believe that ARC will quickly become the defacto standard. Manual memory management has long been the single largest entrance barrier to the language, and the most common complaint. It required sometimes tedious balancing of retain/release statements, and even seasoned professionals were known to occasionally leak an object or forget a release statement in a dealloc method. Garbage collection was tried and largely rejected (for apparent performance reasons). But now ARC has arrived! And I believe it's the future.

If you've already adopted ARC, then you can just drop in the latest version of KissXML and go. If not, then read on.

Older Non-ARC versions of KissXML

The project was converted to ARC in version 5.0. So if you're lazy, or you're unable to adopt the ARC versions due to requirements, then you can grab the latest 4.X release.

Supporting ARC versions of KissXML in Non-ARC projects

The first thing to note is the requirements for supporting ARC in any capacity in your project.

Development requirements for ARC

  • Xcode 4.2
  • Apple LLVM compiler 3.0+ (Build Setting)

Minimum Deployment Targets for ARC

  • iOS: iOS 4.0 or newer
  • Mac: 64-Bit processor running Snow Leopard 10.6 or newer.

If you attempt to compile the latest versions of KissXML in a non-arc project, you'll receive a warning:


Don't ignore these warnings! You'll leak memory like crazy if you do!

(If it weren't for complications when using Xcode's "Convert to Objective-C ARC" tool, the warnings would be errors.)

First ensure you're using the Apple LLVM compiler (version 3.0 or newer):


Then tell the compiler that the KissXML files are ARC:


The warnings will go away, and the compiler will automatically add all the proper retain/release/autorelease calls to the ARC files during compilation.