Configuration

Project Configuration

To integrate the Yoco SDK into your iOS application, you must first configure your project’s Info.plist file. This configuration grants your application the necessary permissions to communicate with the Yoco card machine securely and reliably.

1<key>NSBluetoothAlwaysUsageDescription</key>
2<string>"Your App" needs Bluetooth enabled to communicate with your Yoco
3card machine.</string>
4<key>NSBluetoothPeripheralUsageDescription</key>
5<string>
6 "Your App" needs Bluetooth enabled to communicate with your Yoco
7card machine.
8</string>
9<key>NSLocationWhenInUseUsageDescription</key>
10<string>
11 "Your App" needs your location for transaction security purposes.
12</string>
13<key>UISupportedExternalAccessoryProtocols</key>
14<array>
15 <string>com.miura.shuttle</string>
16 <string>com.miura.rpi</string>
17</array>
18<key>UIBackgroundModes</key>
19<array>
20 <string>bluetooth-central</string>
21 <string>external-accessory</string>
22</array>

Replace “Your App” with your app’s name or change the wording as you see fit.

Initialising the YocoSDK

To perform a transaction with the YocoSDK, you will need to acquire a secret integration key from Yoco by filling out the Yoco Integrations form. A Yoco employee will reach out to you with further details within a few days.

Once you have acquired your secret key, the next step is to call the initialise() function from the YocoSDK. Generally, this lives inside your AppDelegate but it can be called any time before trying to interact with any of the other APIs of the YocoSDK.

Following initialise(), you will need to call configure() with your secret.

Set loggingEnabled to true, to see extra debug logs.

Set environment to .production or .staging for production release or test builds.

You can call configure() multiple times per application run if you wish to change logging output or switch environments.

Ensure that Yoco.applicationWillTerminate() is invoked in your AppDelegate’s applicationWillTerminate callback so that the YocoSDK can clean up appropriately in the event of the application being terminated unexpectedly.

Configuring the YocoSDK
1import YocoSDK
2
3internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
4 YocoSDK.initialise()
5 YocoSDK.configure(secret: "<your-integration-secret>", loggingEnabled: true, environment: .staging)
6 return true
7}
8
9func applicationWillTerminate(_ application: UIApplication) {
10 YocoSDK.applicationWillTerminate()
11}
All functions of the YocoSDK must be called on the main thread.
The YocoSDK cannot build on the i386 architecture.