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
- A set of MobileFirst framework files (see Acquiring the MobileFirst SDK from the MobileFirst Operations Console).
- An existing Xcode MobileFirst project which contains the core frameworks and libraries (see Set up the Xcode project for iOS manually or Add MobileFirst SDK to an iOS Xcode project using CocoaPods).
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 Add watchOS frameworks.
Procedure
- In your Xcode project, add the MobileFirst framework files to our project.
- Select the project root icon in the project explorer.
- From the File menu, choose the Add Files option and navigate to the folder that contains the framework files.
- Click the Options button.
- 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.
- Select the main project (first option) in the Add to targets box.
- Choose the framework files (from the previous table) relevant to our project according to our chosen features.
- 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.
- 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:
- Open the Build Settings page.
- Find the Search Paths section.
- 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 Register iOS applications from the MobileFirst Platform CLI
Parent topic: Add optional iOS frameworks