ASAP for Mobile Platforms

Integrating the SDK with Your App

The next step is to integrate the ASAP SDK with your iOS app. 

You can follow either of the following two methods to perform this step. 

Automated Integration Using CocoaPods

This method involves use of CocoaPods, a dependency manager that lets you add third-party frameworks and libraries to Xcode projects. For information on how to install CocoaPods, visit this link.

As the first step to integrating the SDK with your app using CocoaPods, you must create a Podfile for your project. If you have not created a Podfile already, perform the following steps:

  1. In Terminal, navigate to the top-level folder of your project (the folder with the xcodeproj file).

  2. Execute the $ pod init command.

  3. Then, open the Podfile in Xcode by executing the open -a Xcode Podfile command. The content should look as follows:

    # Uncomment this line to define a global platform for your project
    # platform :ios, '9.0'
    # Uncomment this line if you're using Swift
    # use_frameworks!
    
    target 'My Sample App' do
    
    end
  4. If you use Swift, uncomment the use_frameworks! line.

Next, you must add the Zoho Desk Portal SDK to the Podfile and install the SDK in your project. To do this, perform the following steps. 

  1. Add the following code to the do block of the Podfile. 

    target 'My Sample App' do
      pod 'ZohoDeskPortalSDK', :git => 'https://github.com/zoho/ZohoDeskPortalSDK.git'
    end
  2. Save the Podfile.

  3. Execute the $ pod install command in Terminal.

You have now successfully integrated the SDK with your app using CocoaPods. What this technically means is that your project contains a dependency managed by CocoaPods. So, going forward, you must open your project in Xcode from the .xcworkspace file and not the .xcodeproj file. 

For more information on how to use CocoaPods, click here

Note:
If you use Swift for developing your app, add one of the following lines to the Podfile, based on the Xcode version used.

Manual Integration

If you do not want to integrate the ASAP SDK with your app using CocoaPods, you can perform a manual integration. To do this, perform the following steps. 
  1. Download the zip file of the SDK from this link.

  2. Decompress the zip file and drag and drop the ZohoDeskPortalSDK.framework file to the Embedded Binaries section of your Xcode project bundle.

  3. Then, create a new run script phase from your app target's Build Phases tab.

    Paste the following code snippet in the script text field of the run script that appears. (Make sure that this script appears last in the Build Phases tab.) 

    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZohoDeskPortalSDK.framework/strip-frameworks.sh"
    

    This script helps overcome a bug related to archiving universal binaries in apps submitted to the App Store. Make sure that the VALID_ARCHS build setting of your app does not contain i386 or x86_64 in the release configuration. 

Note:
Make sure to add the  NSPhotoLibraryUsageDescriptionNSCameraUsageDescription, and NSBluetoothPeripheralUsageDescription keys in the info.plist file of your app.