For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Add optional frameworks manually

We can add optional MobileFirst features to our existing MobileFirst app project. The required framework and library files can be generated by IBM MobileFirstâ„¢ Platform Foundation by using IBM MobileFirst Platform Operations Console and added to our Xcode project. The Xcode project must be then configured correctly according to our development goals.


Before you begin

You must have


Overview

Optional frameworks

In addition to the core MobileFirst framework many optional frameworks are available. We can limit the size of your app by including only those frameworks required by the features we use. Some optional frameworks require imported headers in your code.

Table 1. Optional frameworks for iOS
Feature Frameworks (linked in the Link Binary with Libraries list in the Build Phases tab)
JSONStore IBMMobileFirstPlatformFoundationJSONStore

SQLCipher

In addition, import the IBMMobileFirstPlatformFoundationJSONStore header to our code. For more information on setup, see JSONStore.

OpenSSL openssl

IBMMobileFirstPlatformFoundationOpenSSLUtils

For more information on OpenSSL, see Enabling OpenSSL for iOS

Push IBMMobileFirstPlatformFoundationPush

For more information, see Push notification.

In addition, import the IBMMobileFirstPlatformFoundationPush header to our code.

watchOS IBMMobileFirstPlatformFoundationWatchOS. The watchOS framework requires a different structure for the Xcode project. For information on adding the watchOS framework, see Adding watchOS frameworks.


Procedure

  1. In your Xcode project, add the MobileFirst framework files to our project.
    1. Select the project root icon in the project explorer.
    2. From the File menu, choose the Add Files option and navigate to the folder that contains the framework files.
    3. Click the Options button.
    4. Select Copy items if needed and Create groups for any added folders options.

      Note: If you do not select the Copy items if needed option, the framework files are not copied but are linked from their original location.

    5. Select the main project (first option) in the Add to targets box.
    6. Choose the framework files (from the previous table) relevant to our project according to our chosen features.
    7. Click Add.

      Note: These steps copy the relevant MobileFirst frameworks to our project and link them within the Link Binary with Libraries list in the Build Phases tab. If you link the files to their original location (without choosing the Copy items if needed option as described previously) you need to set the Framework Search Paths as described below.

  2. Optional: If you did not copy the framework files into the project as described previously, using the Copy items if needed option, in the Build Phases tab:
    1. Open the Build Settings page.
    2. Find the Search Paths section.
    3. Add the path of the folder that contains the frameworks to the Framework Search Paths folder.


Results

You now have additional frameworks added to our project. Add the required headers to our code according to the Table 1 table.

You must import the headers for some of the frameworks. The syntax depends on the development language:

Objective C:

#import <IBMMobileFirstPlatformFoundation/[frameworkname].h>

Swift:

import [frameworkname]


What to do next

Before we can accesss server resources, we must register your app. See Registering iOS applications from the MobileFirst Platform CLI

Parent topic: Adding optional iOS frameworks