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

Add optional frameworks with CocoaPods

We can add MobileFirst functionality to our existing MobileFirst Xcode project with CocoaPods.

Before you begin

You must have CocoaPods installed in your development environment. In addition we must have a fully functional MobileFirst Xcode project that contains the core MobileFirst framework and libraries. For more information, see Setting up the Xcode project for iOS manually or Adding MobileFirst SDK to an iOS Xcode project using CocoaPods.


The IBM MobileFirst Platform Foundation iOS SDK consists of a collection of pods, available through CocoaPods, that we can add to our project. The pods correspond to core and other functions that are exposed by IBM MobileFirst Platform Foundation. The SDK contains the following optional pods for MobileFirst development:

Table 1. Pods for installing optional frameworks
Pod Feature
IBMMobileFirstPlatformFoundationPush Adds the IBMMobileFirstPlatformFoundationPush framework for enabling Push. For more information, see Push notification.
IBMMobileFirstPlatformFoundationJSONStore Implements the JSONStore feature. Include this pod in your Podfile if you intend to use the JSONStore feature in your app. See JSONStore.">JSONStore.
IBMMobileFirstPlatformFoundationOpenSSLUtils Contains the MobileFirst embedded OpenSSL feature and loads automatically the openssl framework. Include this pod in your Podfile if you intend to use the OpenSSL provided by MobileFirst. For more information on OpenSSL options, see Enabling OpenSSL for iOS.


  1. Open a command line terminal at the location of your Xcode project.
  2. Run the pod init command to create a Podfile file.
  3. Open the new Podfile file also at the Xcode project root.
  4. Comment out or remove the entire existing content.
  5. Add the following lines including the iOS version and save the changes:

    use_frameworks! platform :ios, [version] pod '[pod_name]' For example for the OpenSSL pod using Xcode 9 the file would look like this:

    use_frameworks! platform :ios, 9.0 pod 'IBMMobileFirstPlatformFoundationOpenSSLUtils'

    Note: The previous syntax imports the latest version of the IBMMobileFirstPlatformFoundationOpenSSLUtils pod. If you are are not using the latest version of MobileFirst, you need to indicate the version. For example, for importing the specific patch version 8.0.2016021411 for IBMMobileFirstPlatformFoundationOpenSSLUtils the line would look like this:

    pod 'IBMMobileFirstPlatformFoundationOpenSSLUtils', '8.0.2016021411'

  6. Optional: If you are developing for watchOS your Podfile must contain sections corresponding to the main app and the watchOS extension:

#use the name of the app xcodeproj 'MyWatchApp' use_frameworks! #use the name of the iOS target target :MyWatchApp do platform :ios, 9.0 pod 'IBMMobileFirstPlatformFoundation' end #use the name of the watch extension target target :MyWatchApp WatchKit Extension' do platform :watchos, 2.0 pod 'IBMMobileFirstPlatformFoundation' end

Note: See the previous note about pod versions.

The targets must match your main iOS app and watchOS extension: This is a screen capture of the navigation for the MyWatchApp project with the MyWatchApp folder and the MyWatchApp WatchKit Extension folder highlighted.

The main app section can contain any of the frameworks documented here. However, only the IBMMobileFirstPlatformFoundation pod is supported for the watchOS extension. For more information on watchOS, see Developing for watchOS 2.

  1. Verify that the Xcode project is closed.
  2. Run the pod install command. This command installs the IBMMobileFirstPlatformFoundation pod and any other pods that are specified in the Podfile and their dependencies. It then generates the pods project, and integrates the client project with the MobileFirst SDK. It also adds the required non-MobileFirst dependencies.
  3. Open your [ProjectName].xcworkspace file in Xcode by typing open [ProjectName].xcworkspace from a command line. This file is in the same directory as the [ProjectName].xcodeproj file.
  4. You will need to import the headers for some of the frameworks. The main framework is imported like this: If you are using Push or JSONStore you need to include an independent import:

    Push For Objective C:

    #import <IBMMobileFirstPlatformFoundationPush/IBMMobileFirstPlatformFoundationPush.h> For Swift:

    import IBMMobileFirstPlatformFoundationPush


    For Objective C:

    #import <IBMMobileFirstPlatformFoundationJSONStore/IBMMobileFirstPlatformFoundationJSONStore.h>

    For Swift:

    import IBMMobileFirstPlatformFoundationJSONStore


    For Objective C:

    #import <IBMMobileFirstPlatformFoundationJSONStore/IBMMobileFirstPlatformFoundationWatchOS.h>

    For Swift:

    import IBMMobileFirstPlatformFoundationWatchOS


Your Xcode project can now include optional IBM MobileFirst Platform Foundation features.

What to do next

Before we can accesss server resources, we must register your app. See Registering iOS applications to MobileFirst Server

Parent topic: Adding optional iOS frameworks