{"__v":30,"_id":"55a5917a0f354f0d00fd0345","category":{"__v":11,"_id":"55a589ddaaf9cf1900114dd0","pages":["55a590d580c8a30d00b32404","55a5915680c8a30d00b3240a","55a5917a0f354f0d00fd0345","55a5921d80c8a30d00b32413","55a5a5cb80c8a30d00b32448","55a5b03880c8a30d00b32458","55a611a0249a40190051d928","55a611ec80c8a30d00b32502","55a612ae249a40190051d92d","55a612faaaf9cf1900114f1f","55a911aa27a17d210052523f"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-14T22:14:53.033Z","from_sync":false,"order":1,"slug":"ios-sdk","title":"iOS SDK"},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","user":"55a575ebaaf9cf1900114d73","version":{"__v":23,"_id":"559a61d2dbcfd20d00710b3c","project":"559a61d2dbcfd20d00710b39","createdAt":"2015-07-06T11:09:06.510Z","releaseDate":"2015-07-06T11:09:06.510Z","categories":["559a61d3dbcfd20d00710b3d","55a589ddaaf9cf1900114dd0","55a589e30f354f0d00fd0312","55a589ea80c8a30d00b323cc","55a589f6aaf9cf1900114dd1","55a58d4e80c8a30d00b323e6","55a8e7a227a17d21005251a2","55a93098cf45e1390093f351","55afb085f202b12100cd9e83","55afb22e902fd51700f5f8bf","55afb260902fd51700f5f8c2","55afb28ec8a85321007a5462","55afb294f202b12100cd9e95","55afb29b902fd51700f5f8c5","55afb2a1c8a85321007a5463","55afb2a7902fd51700f5f8c7","55afb2ad902fd51700f5f8c8","55afb2b5902fd51700f5f8ca","55b74b2131bccb190081bedc","55bb441b54f9640d006e6cf2","565711085cb2420d00d70071","5681681330018c0d006bf7ff","588f38b5923d610f00c72dad"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":["5732f597b26eb71900f89a3b"],"next":{"pages":[],"description":""},"createdAt":"2015-07-14T22:47:22.161Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"You may install the MOCA SDK using **CocoaPods** or **manually**.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Option A: Cocoapods\"\n}\n[/block]\nCocoaPods is a dependency manager for Objective-C projects. Learn more [here](http://cocoapods.org/).\n\n1. If you haven't already, install CocoaPods by executing the following: \n\n  ```\n$ sudo gem install cocoapods\n  ```\n \n3.  If you encounter any issues installing cocoapods, please refer to their [getting started guide](https://guides.cocoapods.org/using/getting-started.html)\n  \n2. Create a plain text file named Podfile (or use `touch Podfile` from the command line) in the Xcode project directory with the following content:\n\n  ```\n  pod 'MOCA',                       '1.9.6'\n  ```\n  \n3. Install MOCA SDK by executing the following in the Xcode project directory:\n\n  ```\n  pod install\n  ```\n  \n4. Open the project workspace (`<yourProject>.xcworkspace`) instead of the project file (`<yourProject>.xcodeproj`) to ensure that the MOCA SDK dependency is properly loaded. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Option B: Manual installation\"\n}\n[/block]\n1. To install the MOCA SDK, download latest stable version of [MOCA SDK archive](http://files.mocaplatform.com/releases/moca-ios-sdk-latest.zip).\n2. Xcode with the iOS development kit is required to build an iOS app using MOCA SDK. For a better experience, we recommend XCode 7.\n3. The SDK requires `7.x`, `8.0`, `8.1`, `8.2`, `8.3`, `8.4` or later.\n4. Unzip the archive.\n\nOnce downloaded the SDK, you’ll need to add all necessary frameworks to your project.\n\n5. Open your project in Xcode.\n6. Add the `libMOCALib.a` static library provided in the SDK archive to your app project. The library is a universal FAT library compiled for the following architectures: `armv7/armv7s/arm64/x86_64/i386`. \n7. Make sure to Copy items into destination group's folder is selected.\n8. Press the Finish button.\n9. Ensure that you have added to your project the following dependent frameworks:\n   - `SystemConfiguration.framework`\n   - `CoreTelephony.framework`\n   - `MobileCoreServices.framework`\n   - `CoreBluetooth.framework`\n   - `CoreLocation.framework`\n   - `UIKit.framework`\n   - `AudioToolbox.framework`\n   - `libsqlite3.0.dynlib`\n   - `PassKit.framework` (optional, only add if you plan to deploy Passbook cards)\n\n   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 <i>+ button</i>, to select and add all required frameworks.\n\n10. 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.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/aWxkZDdaS1l5cyU1AszE_xcode.png\",\n        \"xcode.png\",\n        \"846\",\n        \"403\",\n        \"#2d5695\",\n        \"\"\n      ],\n      \"caption\": \"Setting -ObjC linker flag.\"\n    }\n  ]\n}\n[/block]\n####Add the header files\n\n1. Copy the Headers folder from the decompressed file to your XCode project.\n    - Ensure you check the \"copy items if needed\" so headers will be inside your project. \n    - Select the needed target(s), so headers paths will be added automatically. (If you have only one target, select it).\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/j0FWxCVFRcxkuG1x2m2R_add-headers.png\",\n        \"add-headers.png\",\n        \"723\",\n        \"436\",\n        \"#3061a0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n###Xcode does not find the header files!\n\nIf you cannot `#import <MOCA.h>` within your `AppDelegate`, make sure Xcode has added the Header's path correctly to the project's configuration.\n\nGo to `<<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:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/tlY6a3RmmCN6NAV0wMKg_(PROJECT_DIR).png\",\n        \"(PROJECT_DIR).png\",\n        \"802\",\n        \"361\",\n        \"#1a5cad\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","excerpt":"This section describes how to add MOCA iOS SDK to your app.","slug":"moca-ios-sdk-setup","type":"basic","title":"Installation"}

Installation

This section describes how to add MOCA iOS SDK to your app.

You may install the MOCA SDK using **CocoaPods** or **manually**. [block:api-header] { "type": "basic", "title": "Option A: Cocoapods" } [/block] CocoaPods is a dependency manager for Objective-C projects. Learn more [here](http://cocoapods.org/). 1. If you haven't already, install CocoaPods by executing the following: ``` $ sudo gem install cocoapods ``` 3. If you encounter any issues installing cocoapods, please refer to their [getting started guide](https://guides.cocoapods.org/using/getting-started.html) 2. Create a plain text file named Podfile (or use `touch Podfile` from the command line) in the Xcode project directory with the following content: ``` pod 'MOCA', '1.9.6' ``` 3. Install MOCA SDK by executing the following in the Xcode project directory: ``` pod install ``` 4. Open the project workspace (`<yourProject>.xcworkspace`) instead of the project file (`<yourProject>.xcodeproj`) to ensure that the MOCA SDK dependency is properly loaded. [block:api-header] { "type": "basic", "title": "Option B: Manual installation" } [/block] 1. To install the MOCA SDK, download latest stable version of [MOCA SDK archive](http://files.mocaplatform.com/releases/moca-ios-sdk-latest.zip). 2. Xcode with the iOS development kit is required to build an iOS app using MOCA SDK. For a better experience, we recommend XCode 7. 3. The SDK requires `7.x`, `8.0`, `8.1`, `8.2`, `8.3`, `8.4` or later. 4. Unzip the archive. Once downloaded the SDK, you’ll need to add all necessary frameworks to your project. 5. Open your project in Xcode. 6. Add the `libMOCALib.a` static library provided in the SDK archive to your app project. The library is a universal FAT library compiled for the following architectures: `armv7/armv7s/arm64/x86_64/i386`. 7. Make sure to Copy items into destination group's folder is selected. 8. Press the Finish button. 9. Ensure that you have added to your project the following dependent frameworks: - `SystemConfiguration.framework` - `CoreTelephony.framework` - `MobileCoreServices.framework` - `CoreBluetooth.framework` - `CoreLocation.framework` - `UIKit.framework` - `AudioToolbox.framework` - `libsqlite3.0.dynlib` - `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 <i>+ button</i>, to select and add all required frameworks. 10. 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. [block:image] { "images": [ { "image": [ "https://files.readme.io/aWxkZDdaS1l5cyU1AszE_xcode.png", "xcode.png", "846", "403", "#2d5695", "" ], "caption": "Setting -ObjC linker flag." } ] } [/block] ####Add the header files 1. 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). [block:image] { "images": [ { "image": [ "https://files.readme.io/j0FWxCVFRcxkuG1x2m2R_add-headers.png", "add-headers.png", "723", "436", "#3061a0", "" ] } ] } [/block] ###Xcode does not find the header files! If you cannot `#import <MOCA.h>` within your `AppDelegate`, make sure Xcode has added the Header's path correctly to the project's configuration. Go to `<<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: [block:image] { "images": [ { "image": [ "https://files.readme.io/tlY6a3RmmCN6NAV0wMKg_(PROJECT_DIR).png", "(PROJECT_DIR).png", "802", "361", "#1a5cad", "" ] } ] } [/block]