For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Migrate an existing native iOS projects to version V8.0.0 with CocoaPods
Migrate your existing native iOS project to work with V8.0.0 by getting the IBM MobileFirstâ„¢ Platform Foundation iOS SDK using CocoaPods and making changes in the project configuration.
Before you begin
Note: MobileFirst development is supported in Xcode from version 7.1 by using iOS 8.0 and later. You must have:
- CocoaPods installed in your development environment. For more information, see the "Getting Started" guide for CocoaPods installation.
- Xcode 7.1 with iOS 8.0 or higher for our development environment.
- An app integrated with MobileFirst 6.2 or later.
The SDK contains required and optional SDKs. Each required or optional SDK has its own pod.
The required IBMMobileFirstPlatformFoundation pod is the core of the system. It implements client-to-server connections, handles security, analytics, and application management. The following optional pods provide additional features.
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.
Procedure
- Open your project in Xcode.
- Delete the WorklightAPI folder from your Xcode project (move it to trash).
- Modify your existing code in the following ways:
- Remove $(SRCROOT)/WorklightAPI/include from the header search path.
- Remove $(PROJECTDIR)/WorklightAPI/frameworks from the frameworks search path.
- Remove any references to the static librarylibWorklightStaticLibProjectNative.a.
- In the Build Phases tab, remove the links to the following frameworks and libraries (these are re-added automatically by CocoaPods):
- libWorklightStaticLibProjectNative.a
- SystemConfiguration.framework
- MobileCoreServices.framework
- CoreData.framework
- CoreLocation.framework
- Security.framework
- sqlcipher.framework
- libstdc++.6.dylib
- libz.dylib
- Close Xcode.
- Get the IBM MobileFirst Platform Foundation iOS SDK from CocoaPods. To get the SDK, complete the following steps:
- Open Terminal at the location of your new Xcode project.
- Run the pod init command to create a Podfile file.
- Open the Podfile file that is in the root of the project with a text editor.
- Comment out or remove the existing content.
- Add the following lines and save the changes, including the iOS version:
use_frameworks! platform :ios, 9.0 pod 'IBMMobileFirstPlatformFoundation'
- Specify additional pods in the file from the list above, if your app needs to use the additional functionality that they provide. For example, if your app uses OpenSSL, the Podfile might look like this:
use_frameworks! platform :ios, 9.0 pod 'IBMMobileFirstPlatformFoundation' pod 'IBMMobileFirstPlatformFoundationOpenSSLUtils'
For a list of optional pods, see Pods for installing optional frameworks.
Note:
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'
- Verify that the Xcode project is closed.
- Run the pod install command.
This command installs the MobileFirst SDK IBMMobileFirstPlatformFoundation.framework and any other frameworks that are specified in the Podfile and their dependencies. It then generates the pods project, and integrates the client project with the MobileFirst SDK.
- 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.
- Replace all of the existing MobileFirst imports of headers with a single entry of the following new umbrella header:
- Objective C:
#import <IBMMobileFirstPlatformFoundation/IBMMobileFirstPlatformFoundation.h>
- Swift:
import IBMMobileFirstPlatformFoundation
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
- JSONStore
- For Objective C:
#import <IBMMobileFirstPlatformFoundationJSONStore/IBMMobileFirstPlatformFoundationJSONStore.h>
- For Swift:
import IBMMobileFirstPlatformFoundationJSONStore
- In the Build Settings tab, under Other Linker Flags, add $(inherited) at the beginning of the -ObjC flag. For example:
Figure 1. Adding $(inherited) to ObjC flag in Xcode Build Settings
![]()
- Beginning with Xcode 7, TLS must be enforced, see Enforcing TLS-secure connections in iOS apps.
Results
Your application is now upgraded to work with the IBM MobileFirst Platform Foundation, V8.0.0 iOS SDK.
What to do next
- Replace the client-side APIs that are discontinued or not in V8.0.0. For more information about the changes in the client-side API, see Update the iOS code. For more information about the migration assistance tool, see Scanning existing MobileFirst native iOS apps to prepare for MobileFirst version 8.0.
- Before we can access server resources, we must register your app. See Register iOS applications to MobileFirst Server. For details about the mfpclient.plist file, see iOS client properties file.
Parent topic: Migrating existing native iOS applications