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

Add MobileFirst SDK to an iOS Xcode project using CocoaPods

We can add MobileFirst functionality to our existing or new Xcode project with CocoaPods. Once your project is set up, we can continue developing your code.

Before you begin

Note: MobileFirst development is supported in Xcode from version 7.1 by using iOS 8.0 and later. You must have


We can create a IBM MobileFirstâ„¢ Platform Foundation Xcode project by adding core frameworks and libraries with CocoaPods. Addtional optional CocoaPods may be added.


  1. Create an Xcode project if one does not exist.
  2. Open a command line in the Xcode project folder.
  3. Run the pod init command to create a Podfile file.
  4. Open the new Podfile file also at the Xcode project root.
  5. Comment out or remove the entire existing content.
  6. Add the following lines including the iOS version and save the changes:

    source '' use_frameworks! platform :ios, 9.0 target :name-of-the-target-in-xcode-project do pod 'IBMMobileFirstPlatformFoundation' end

  7. Optional: If we want to add any optional features, add additional pods. For a list of available features see Table 1. Add an additional line for each pod, for example:

    pod 'IBMMobileFirstPlatformFoundationJSONStore'


    The previous syntax imports the latest version of the IBMMobileFirstPlatformFoundation pod. If you are not using the latest version of MobileFirst, you need to add the full version number, including the major, minor, and patch numbers. The patch number is in the format YYYYMMDDHH. For example, for importing the specific patch version 8.0.2016021411 of the IBMMobileFirstPlatformFoundation pod the line would look like this:

    pod 'IBMMobileFirstPlatformFoundation', '8.0.2016021411' Or to get the last patch for the minor version number the syntax such is

    pod 'IBMMobileFirstPlatformFoundation', '~>8.0.0'

  8. 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

The previous 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 ExtensionMyWatchApp and WatchKit Extension in Xcode project

The main app section can contain any of the frameworks documented here: Table 1. 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 other required 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. The main framework is imported like this:


    import IBMMobileFirstPlatformFoundation

    Objective C

    #import <IBMMobileFirstPlatformFoundation/IBMMobileFirstPlatformFoundation.h>

  5. Beginning with iOS9 TLS must be enforced, see Enforcing TLS-secure connections in iOS apps.


We can now start developing your native iOS application with the IBM MobileFirst Platform Foundation integration.

What to do next

Before we can access server resources, we must register your app. See Registering iOS applications from the MobileFirst Platform CLI. For details about the mfpclient.plist file see iOS client properties file

Parent topic: Methods of setting up your environment