Copying SDK and configuration files from the project

You can get framework and library files that are required for MobileFirst development by creating a MobileFirst project and copying certain generated files into your Xcode project. Then, in Xcode, you configure what frameworks, libraries, and build settings to include.

Before you begin

You must have already created a MobileFirst native API project with MobileFirst Studio or the MobileFirst Platform Command Line Interface. For more information, see Creating MobileFirst projects with MobileFirst Studio or the create command.

About this task

You need to copy and reference the files generated from MobileFirst Studio or the MobileFirst Platform Command Line Interface to your native iOS project in the Xcode development environment in order for Xcode to find the frameworks and libraries for linking. There are additional settings that need to be configured.

Procedure

Setting up the Xcode project to include the MobileFirst API.

  1. In your Xcode project add the MobileFirst files to your project:.
    1. Select the project root icon in the project explorer.
    2. From the File menu choose the AddFiles option and add the WorklightAPI folder and the worklight.plist file from your MobileFirst project.
    3. Select Copy items if needed and Create groups for any added folders options.
    4. Click Add.
      Note: These steps add the MobileFirst frameworks to the Link Binary with Libraries list in the Build Phases tab.
  2. Make sure the following resources are linked to your project in the Link Binary With Libraries section of the Build Phases tab.
    • IBMMobileFirstPlatformFoundation.framework
    • SystemConfiguration.framework
    • MobileCoreServices.framework
    • CoreData.framework
    • CoreLocation.framework
    • Security.framework
    • sqlcipher.framework
      Note: Some frameworks may already be linked.
    • libstdc++.6.dylib
    • libz.dylib
    • libc++.dylib
    Important: If you are using Xcode 7, link libstdc++.6.tbd, libz.tbd, and libc++.tbd, instead of the corresponding .dylib files. Using Xcode 7 and iOS9 require the latest interim fix.
    Important: If you are using the latest interim fix link these framework:
    • openssl.framework
    • If you want to enable the JSONStore feature (which is optional in the latest interim fix) link the following frameworks:
      • IBMMobileFirstPlatformFoundationJSONStore.framework
      • SQLCipher.framework
  3. If you are using the JSONStore feature, import the IBMMobileFirstPlatformFoundationJSONStore framework.

    For Objective C

    #import <IBMMobileFirstPlatformFoundationJSONStore/IBMMobileFirstPlatformFoundationJSONStore.h>

    For Swift

    import IBMMobileFirstPlatformFoundationJSONStore
  4. Optional: If the required frameworks do not appear in the Build Phases tab:.
    1. Open the Build Settings page.
    2. Find the Search Paths section.
    3. Add the following entry to the Framework Search Paths: $(PROJECT_DIR)/WorklightAPI/Frameworks. If you did not copy the folder into the Xcode project, enter the full path of the WorklightAPI folder.
  5. in the Other Linker Flags field, enter the following value: -ObjC
  6. If you are using Swift see Configuring a Swift application
  7. In the Deployment section, select a value for the iOS Deployment Target field that is greater than or equal to 6.0.
  8. Optional: Set the build options.
    Important: If you are using Xcode 7, in the Build Settings tab:
    1. Open the Build Options section.
    2. Set Enable Bitcode to No.
    For more information, see Disabling bitcode in Xcode builds.