Cardknox is now Sola
Learn More
LogoLogo
Contact Us
  • Introduction
  • 🔗API
    • Transaction API
      • Credit Card
      • Check (ACH)
      • EBT
      • Gift Card
      • Fraud
    • Customer and Recurring API
    • Reporting API
    • Account Boarding API
      • Account Boarding Merchant Agreement
      • Account Boarding Swagger UI
    • Code Samples
    • Error Codes
  • 📦SDK
    • .NET SDK
      • Transaction Workflow
    • iOS SDK
      • iOS SDK - Technical Guide
      • Workflow
    • Android SDK
      • Android SDK - Technical Guide
  • 🧰 Cardknox Products
    • 3D Secure 2.0
      • Client-Side Integration
        • Client-Side Integration (Non-iFields)
      • Server-Side Integration
    • Account Updater
    • Batch Processing
    • Browser-Based POS systems (BBPOS)
    • CloudIM Developer Guide
    • Deep Linking
      • Deep Linking Integration for Third-Party Websites
    • EBT Online
    • Gateway Emulators
    • iFields
      • Angular iFields
    • Merchant Portal
      • FAQ
    • Mobile App
    • Split Capture
    • Tap to Phone - Android
    • Partner Portal
    • PaymentSITE
      • QR Codes for PaymentSITE
    • Webhooks
  • 📱Mobile Wallets
    • Apple Pay Hosted Checkout
      • Apple Pay Hosted Checkout Initial Setup
      • Apple Pay Prerequisites
      • Apple Pay Hosted Checkout Objects Reference (Request)
      • Apple Pay Hosted Checkout Objects Reference (Response)
      • Apple Pay iFields Integration
      • Apple Pay Hosted Checkout Sample Code
      • Apple Pay Features
      • Set up Apple Pay Merchant ID with Cardknox
    • Click-To-Pay - Hosted Checkout
      • Click-To-Pay Initial Setup
      • Click-To-Pay Sample Code
      • Click-To-Pay iFields Integration
      • Click-To-Pay Objects Reference (Request)
      • Click-To-Pay Objects Reference (Response)
    • Google Pay Hosted Checkout
      • Google Pay Control Object
      • Google Pay Request Objects
      • Google Pay Response Objects
      • Google Pay Sample Code
      • iFields Integration
      • Google Pay FAQ
  • 🔌Plugins
    • Netsuite
      • NetSuite Features and Demo
    • WooCommerce
    • Magento Plugin
    • RMH (Retail Management Hero)
    • RMS (Retail Management Systems)
  • 📖Articles
    • Frequently Asked Questions
    • How to Build POS Integration Flows
    • Card Present Integration Guide
  • Glossary of Terms
Powered by GitBook
On this page
  • Overview
  • Technical Overview
  • Framework File Integration
  • Required Settings Setup
  • Disabling Bitcode
  • Info.plist merge
  • CardknoxPaymentsSDK headers import
  • Objective C import
  • Swift import

Was this helpful?

Export as PDF
  1. SDK
  2. iOS SDK

iOS SDK - Technical Guide

Last updated 2 years ago

Was this helpful?

Overview

This document helps developers to set up and integrate Cardknox Payments SDK into Objective C and Swift projects. The document contains steps for framework integration, required settings setup and import of SDK headers.

Technical Overview

  • The SDK is distributed as a .framework

  • .framework contains the CardknoxPaymentsSDK binary and ObjectiveC .h headers describing the SDK API

  • The CardknoxPaymentsSDK does not contain bitcode and cannot be integrated with applications that require bitcode

  • .framework only supports arm64 64-bit architecture for device builds. Simulator targets are not supported.

  • SDK minimum deployment target is 14.0

Framework File Integration

  1. Download the zip file with CardknoxPaymentsSDK.framework. Links for downloading framework files can find in section.

  2. Extract CardknoxPaymentsSDK.framework from downloaded .zip file.

  3. Copy the downloaded .framework file to the root of your project (for example, alongside the xcodeproj file):

  4. Open the General under the application Target. Find the Frameworks, Libraries, and Embedded Content section. Click on the + icon for adding a framework to the project.

  5. + icon opens the dialog screen for adding framework. On dialog click on Add Other dropbox, which opens a menu. On the menu click on Add files...

  6. Add files... opens Choose frameworks and libraries to add dialog. On dialog find the root folder of the project and select CardknoxPaymentsSDK.framework file.

  7. After adding the framework, the CardknoxPaymentsSDK.framework must be in the Frameworks, Libraries, and Embedded Content section. Pay attention to the value in the Embed column. The value must be Embed & Sign.

  8. Also after adding the framework, the CardknoxPaymentsSDK.framework must be in Link Binary With Libraries and Embed Frameworks sections. Link Binary With Libraries and Embed Frameworks sections are in the Build Phases tab, under the application Target.

Required Settings Setup

Disabling Bitcode

The Cardknox SDK doesn’t support bitcode. To disable Bitcode follow these steps:

  1. Click on your application target. Choose Build Settings > All

Info.plist merge

  1. The CardknoxPaymentsSDK framework contains an Info.plist file which contains various key/value pairs that are required by the framework, for example, it defines a NSBluetoothAlwaysUsageDescription key with a value similar to “Bluetooth is required to find, connect to and transfer data between a card reader and the app"

  2. The application that is using the CardknoxPaymentsSDK framework also defines an Info.plist file with its own key/value pairs

  3. The goal is to merge the framework Info.plist file with the application Info.plist in order to avoid runtime errors in the CardknoxPaymentsSDK framework code due to missing key/values. XCode doesn't perform any merges automatically.

  4. Note that if there are identical keys present in the application Info.plist and in the framework Info.plist files, such as the NSBluetoothAlwaysUsageDescription key; the value defined in the application Info.plist for that key will have priority during the merge; making it easy to override values in the framework Info.plist

  5. To merge the two files, define a Run Script step in the XCode application Target's Build Phases section and run the PlistBuddy tool, as following:

    • Delete the Type a script... contents of the input box and add the following command

CardknoxPaymentsSDK headers import

This section shows how to use the CardknoxPaymentsSDK in Objective C and Swift code. For Objective C it’s sufficient to reference the main SDK header. For Swift, an umbrella header is required to wrap the main SDK header into a Swift compatible format.

Objective C import

For Objective C applications - reference the CardknoxPaymentsSDK main header file in your code with #import "CardknoxPaymentsSDK/CardknoxPaymentsSDK.h"

Swift import

For Swift applications - an umbrella header needs to be created and referenced by your application Target in order to properly embed the framework into your app. To create the umbrella header, follow the steps:

  1. Clear all text in the header file

  2. Navigate to your target’s Build Settings > All

Set the Enable Bitcode option to No in the Build Options section

Add a new Run Script step to Build Phases

Make sure that the Run Script step is the last step, below other steps (Compile Sources, Embed Frameworks, etc.). You can reposition steps by dragging up and down:

Expand the Run Script step

/usr/libexec/PlistBuddy -c "merge CardknoxPaymentsSDK.framework/Info.plist" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

Create a new header file in the Target folder via File menu > New... > File.... Choose Header File option. For example, the name might be: iOS.Swift.SampleApp-Bridging-Header.h

Add #import "CardknoxPaymentsSDK/CardknoxPaymentsSDK.h" into the header file

Find the Objective-C Bridging Header option in the Swift Compiler - General section and set its value to be the relative path to the header file. For example, an application target named iOS.Swift.SampleApp will have the iOS.Swift.SampleApp/iOS.Swift.SampleApp-Bridging-Header.h path specified. The assumption is that the header file is in the Target folder, side by side the info.plist file.

📦
iOS SDK - Get Started