Objective-C Mapping

The Objective-C mapping supports the two memory management models provided with the Objective-C language:

  • the "manual release-retain" (MRR) method where the application is responsible for calling retain and release.
  • the "automatic reference counting" (ARC) method where the compiler takes care of inserting the appropriate memory management calls.

The generated code is the same for both models, you don't have to compile your Slice files with different slice2objc compiler options to generate code for one model or the other. The generated code uses preprocessor macros to check if ARC is enabled. Unless specified, the examples shown in the following sections of the mapping use ARC.