Minumum OS supported: iOS 10
CocoaPods is a dependency manager for Objective-C projects. Learn more here.
- If you haven't already, install CocoaPods by executing the following:
$ sudo gem install cocoapods
If you encounter any issues installing cocoapods, please refer to their getting started guide
Create a plain text file named Podfile (or use
touch Podfilefrom the command line) in the Xcode project directory with the following content:
target 'YOUR_TARGET_NAME' do pod 'MOCA', '~> 3.8.0' end
Please check what is the latest version of the SDK by here
- Install MOCA SDK by executing the following in the Xcode project directory:
- Open the project workspace (
<yourProject>.xcworkspace) instead of the project file (
<yourProject>.xcodeproj) to ensure that the MOCA SDK dependency is properly loaded.
In order to use the MOCA Header symbols in your Swift application, you'll need to create a Bridging Header file.
1 - Download the file (or create a new one).
2 - Copy it to your Xcode project. Ensure you select "copy if needed" in the copy dialog box.
3 - Add the Bridging header to your Xcode Project.
Ensure you have selected "All" options instead of "Basic"
Otherwise the option could remain hidden.
- To install the MOCA SDK, download latest stable version of MOCA SDK archive.
- Xcode with the iOS development kit is required to build an iOS app using MOCA SDK. For a better experience, we recommend Xcode 12.
- Unzip the archive.
Once downloaded the SDK, you’ll need to add all necessary frameworks to your project.
Open your project in Xcode.
libMOCALib.astatic library provided in the SDK archive to your app project. The library is a universal FAT library compiled for the following architectures:
Make sure to Copy items into destination group's folder is selected.
Press the Finish button.
Ensure that you have added to your project the following dependent frameworks:
PassKit.framework(optional, only add if you plan to deploy Passbook cards)
To do this, select your project file in the file explorer, select your target, and select the Build Phases sub-tab. Under Link Binary with Libraries, press the + button, to select and add all required frameworks.
In Xcode, go to the Build Settings of your project. Next go to the “linking” section and add the flag –ObjC in Other Linker Flags.
- Copy the Headers folder from the decompressed file to your XCode project.
- Ensure you check the "copy items if needed" so headers will be inside your project.
- Select the needed target(s), so headers paths will be added automatically. (If you have only one target, select it).
When you add Objective-C header files into your Swift project, Xcode will ask you to create a Bridging Header file. This file allows Xcode to translate the Objective-C methods to Swift. This bridging file allows you to use MOCA SDK methods in Swift.
If you cannot
#import <MOCA.h> within your
AppDelegate, make sure Xcode has added the Header's path correctly to the project's configuration.
<<Your Project Name>>/<<Your Build Target>>/Build Settings/Search Paths -> Header Search Paths and add the header's path. You can use the
$(PROJECT_DIR) build setting to create relative paths: