iOS installation

This guide describes how to add AbleLib to your iOS app.

Before you start, make sure you have a valid licence key. If you don't have one, please follow these instructions.

Keep in mind that the current minimum iOS version supported by AbleLib is 11.0.

AbleLib on iOS is distributed by CocoaPods. Simply add the AbleLib pod to your Podfile:

use_frameworks!

target :YourTargetName do
  pod 'ablelib'
end

Then, run pod install, as usual.

If pod install fails complaining that the AbleLib pod could not be found, try running pod update instead.

After you've done installing pods, make sure to open the your workspace, and not the project:

xed .

iOS mandates that you set the Bluetooth permissions in Info.plist.

  1. If your app targets iOS 13 and above, add the NSBluetoothAlwaysUsageDescription key and provide a user-facing description why your app uses Bluetooth as its value.
  2. If your app targets iOS 12 and below, add NSBluetoothPeripheralUsageDescription as well.

The last step is to register the licence key with the library.

Open AppDelegate.swift and add the following lines to it:

import Able // Import the Able framework

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
  func application(_ application: UIApplication, 
                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    AbleLib.licenceKey = "INSERT_YOUR_LICENCE_KEY_HERE" // Register the licence key with the library
  }
}

That's it! Test your installation by scanning for nearby devices.