Importing Libraries and Code for Applications Enabled with ARC

Import the generated MBO code and associated libraries into the iOS development environment, to support applications enabled with automatic reference counting (ARC).

  1. Create a non-ARC static library target for the generated code.
    1. Select the application project file in Xcode, and click on Add Target at the bottom of the Project Settings screen. When prompted, select the "Cocoa Touch Static Library" template from the Framework & Library section and click Next.
    2. Enter the project name with the name you want for your library, for example, "generatedcode_lib". Make sure the "Use Automatic Reference Counting" option is not selected. Click on Finish. You have created a second target in your project.

    3. Delete the sample class files the wizard created (generatedcode_lib.h, and generatedcode_lib.m).
  2. Make sure the static library is not using ARC by selecting the generatedcode_lib target, going to "Build Settings," and verifying "Automatic Reference Counting" is set to "NO".
  3. Add generated code into the static library target.
    1. Right click on the generatedcode_lib folder from the Group & File view, and select Add Files to ....
    2. Select your generated code location, and select the option "Add to targets" to "generatedcode_lib". Do not select <your main target>.
    3. Click Add.

  4. Modify the build settings of the static library target.
    1. Select the generatedcode_lib target, and go to "Build Settings", and to "Header Search Paths".
    2. Add the location of the SUP client stack includes folder. Make sure the "Recursive" checkbox is checked.
  5. Link the main application target with the new static library.
    1. Select your main application target, then click on “Build Phase” and expand the “Link Binary With Libraries” section.
    2. Click on the plus (+) button and select the new static library from the list.
  6. Add the static library as a dependency.
    1. Select your main application target, then click on “Build Phase” and expand the “Target Dependencies” section.
    2. Click on the plus (+) button and select the new static library from the list.

  7. Make sure that ARC is enabled for your main application target.
    1. Select the main target, and go to “Build Settings”.
    2. Verify that Automatic Reference Counting” is set to “YES”.
  8. Add your ARC enabled code into the main application target.
  9. Import the Unwired Platform client stack libraries to the main target. Perform the steps in Developer Guide: iOS Object API Applications > Development Task Flow for DOE-based Object API Applications > Creating a Project > Importing Libraries and Code, to import and add only the libraries to the main target. Do not add generated code to the main target, because you have created the secondary static library target with the generated code.
  10. Build your ARC-enabled main application target with the Unwired Platform client stack and generated code.

    Ignore semantic issue warnings during compilation. For example:

    "Semantic Issue
    Type of property ‘databaseName’ does not match type of accessor ‘setDatabaseName:’"