Asset 2

biidCoreSDK - iOS Quick Start Guide

Version 3.2.267

Prerequisites

Before you begin you need a few things set up in your environment:

  • Xcode 10.2 or later
  • An Xcode project targeting iOS 10.3 (11.0 or later preferred)
  • Swift projects must use Swift 4.2
  • Cocoapods 1.6.2 or later


Add the biidCoreSDK to your project

The biidCoreSDK should be installed into an Xcode project using Cocoapods.

You can install Cocoapods by following the installation instructions. Once installed, using the terminal you can add the biidCoreSDK to your project as follows:

  1. Create a PodFile if you don’t already have one:

    $ cd your-project directory
    $ pod init
    

    This will generate a default Podfile

  2. Add the biidCoreSDK to your Podfile as follows:

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, '9.0'
    use_frameworks!
    
    target '<your-target-name>' do
        pod 'biidCoreSDK', '3.2.267'
    end
    
  3. Install the pod and once done open the xcworkspace file to launch the project in Xcode:

    $ pod install
    $ open your-project.xcworkspace
    


Add Manifest File to your project

A manifest file is required to successfully initialize the biidCoreSDK for your project. A Manifest file will either be provided or it can be generated and downloaded directly from your back office environment.

Add the manifest to your project:

  1. Drag it to your Xcode project
  2. Ensure that Copy items if needed is ticked
  3. Ensure that correct target in Add to targets is ticked


Configure Certificate Pinning

Certificate pinning ensures that the SSL certificate returned from an SSL connection exactly matches a copy of the certificate stored locally within the app.

Configure your app for certificate pinning:

  1. Download a DER formatted copy of the SSL certificate for the endpoint defined in the manifest file

  2. Ensure that the certificate has one of the following file extensions

    ".cer", ".CER", ".crt", ".CRT", ".der", ".DER"
    
  3. Drag the certificate to your Xcode project

  4. Ensure that Copy items if needed is ticked

  5. Ensure that correct target in Add to targets is ticked

Notes:

To ensure the maximum level of security it is highly recommended that the certificate used for pinning is:

a leaf certificate for the endpoint

is not a wild card certificate


Importing the biidCoreSDK into your code

Import the biidCoreSDK into your code:

Swift3

    import biidCoreSDK

ObjC

    @import biidCoreSDK;


Referencing the biid Client shared instance

The biid client, and it’s APIs and properties, is accessible through the SDK’s getClient() function.

Assigning the biid client to a var can be done as follows:

Swift3

    var biidClient = SDK.getClient

ObjC

    id<Client>biidClient = [SDK getClient];

Alternatively the getClient function can be called inline if preferred:

Swift3

    SDK.getClient.xxxxxx

ObjC

    [biidCoreSDK.getClient xxxxxx];


Initializing the SDK

The SDK can be initialized as follows:

Swift3

    do {
        try SDK.getClient.initialize()
    }
    catch (let exception) {
        // Handle exception
    }

ObjC

    NSError *error;
    [biidCoreSDK.getClient initialize:&error];
    if (error) {
        // Handle error
    }


Detailed Documentation

For further information about the biidCoreSDK, check out the full documentation.