Integrating the SDK

Prerequisites

  • Xcode 11.3.1 or later
  • An iOS device running iOS 13.3.1 or later
  • A valid Wavecell developer account (TBD)

Set up the development environment

In this section, we will create an iOS project, and integrate the Wavecell SDK into the project.

Create an iOS project

Now, let’s build an iOS project from scratch.

  1. Open Xcode and click Create a new Xcode project.
  2. Choose Single View App as the template and click Next.
  3. Choose the folder where to store the project and click Create.
  4. Go to the TARGETS > Project Name > General > Signing menu, choose Automatically manage signing, and then click Enable Automatic on the pop-up window.

    create-xcode-project-for-sdk-integration

Integrate the SDK

  1. Go to SDK Downloads, download the latest version of the Wavecell SDK for iOS, and unzip the downloaded SDK package.

    wavecell-sdk-package-contents

  2. Copy Wavecell.framework bundle to Frameworks folder.

    copy-wavecell-framework-to-xcode-project

  3. Go to the TARGETS > Project Name > General > Frameworks, Libraries, and Embedded Content menu.

    embedding-wavecell-framework-to-xcode-project

  4. Drag the Wavecell.framework bundle from the Frameworks folder into the Frameworks, Libraries, and Embedded Content section.

    embedded-wavecell-framework-to-xcode-project

Enable VoIP capabilities

  1. Go to the TARGETS > Project Name > Signing & Capabilities and add Background Modes. Enable Audio, AirPlay,… and Voice over IP there.

    xcode-project-capabilities-background-modes

  2. Go to the TARGETS > Project Name > Signing & Capabilities and add Push Notifications. This step is only required for receiving incoming calls.

    xcode-project-capabilities-push-notifications

  3. Go to the TARGETS > Project Name > Info and add privacy description for microphone usage.

    NSMicrophoneUsageDescription describes the reason your app accesses the microphone. When the system prompts the user to allow access, this string is displayed as part of the alert, and it cannot be left empty.

    microphone-usage-policy-description

Disable Bitcode

Bitcode is an Apple technology that enables app recompilation in order to reduce its size.

Wavecell.framework is built without bitcode which in turn implies that restriction to application.

  • Go to the TARGETS > Project Name > Build Settings and set Enable Bitcode to No.

    disable-bitcode-in-xcode-project

Build and run

Let’s verify if app can invoke functions from Wavecell.framework:

  1. Modify AppDelegate.swift by adding the following lines:

    import Wavecell
    print("\(Wavecell.shared.version())")
    
  2. Build (Cmd+B) and Run (Cmd+R) the app project

  3. If everything goes well Xcode console will have a message similar to:

    0.1.0b24-r11d3b9e
    

    print-wavecell-sdk-version-from-xcode-project

Push notification setup

Wavecell backend solution includes the notification server. The notification server establishes secure connection with APNS in order to send push notifcations to your application.

There are two types of secure connections:

Wavecell backend supports both of them.

apn-provider-connection-types

Certificate-based

For this type of connection please generate VoIP Service Certificate at Apple developer account.

request-voip-services-certificate

  1. Once certificate is ready click Download and save it to your hard drive (voip_services.cer file).

    download-voip-services-certificate

  2. Open the voip_services.cer file with Keychain Access app on your computer. If you are asked which keychain to add the certificate to, select login option.

  3. In Keychain Access app, select Certificates option in the bottom section of the left sidebar. You will now need to find the certificate you have created.

  4. Export your Certificate as a .p12 file.

    export-voip-services-certificate

  5. Convert .p12 file to .pem using the openssl command in Terminal:

    openssl pkcs12 -in PATH_TO_YOUR_P12 -nokeys -out cert.pem -nodes
    openssl pkcs12 -in PATH_TO_YOUR_P12 -nocerts -out key.pem -nodes
    openssl rsa -in key.pem -out key.pem
    cat cert.pem key.pem > apns-voip-services.pem
    
  6. Register the Certificate (apns-voip-services.pem file) at Wavecell developer account.

Token-based

For token-base connection you will need to generate a key at Apple developer account with Apple Push Notification Service enabled.

  1. Once key is ready click Download and save it to your hard drive (AuthKey_<Key ID>.p8 file).
  2. Register the Key ID and Key (.p8 file) at Wavecell developer account.