Getting started

In this guide, you will learn how to get started with the Genius Scan SDK for iOS.

Overview

The SDK for iOS is composed of multiple iOS frameworks. This modular configuration enables you to integrate just what you need.

  • Core: The core module of the SDK including the low-level image processing, basic UI components, and PDF generation. You always have to integrate this framework in your app.
  • OCR: The OCR module which allows to extract text (and layout) from images. Only integrate this if you plan to perform local text recognition on your documents.
  • ScanFlow: A high-level scanner module that simplifies the integration of the SDK in your app. Only integrate this if you choose to do a simple integration of the SDK.

Sample code

We provide two iOS demo projects as part of the SDK:

  • GSSDKSimpleDemo demonstrates how to start a simple scan flow using the ScanFlow framework.
  • GSSDKCustomDemo demonstrates a custom integration of the SDK using the Core framework. You will also see how to perform OCR on the scanned document with the OCR framework, as well as how to generate a PDF file.

Size of the SDK

The SDK framework files used during development may seem large, but they include slices for all device architectures (arm64, x86_64) and debug symbols. Deployed on your user’s devices, the impact is much smaller.

We provide here the approximate impact of the SDK on your app’s size. The download size is the increase in size of your app when downloaded by your users. The installed size represents the size of the SDK once installed on the user’s device.

Core OCR ScanFlow
Download size 7 MB 1.2 MB < 1 MB
Installed size 10 MB 2.5 MB < 1 MB

Because the Genius Scan SDK is provided as dynamic frameworks placed in your app’s bundle, the App Store’s delta updates logic will skip downloading them if you update your app without updating the Genius Scan SDK.

Setup

Integrating the frameworks

Manually

Drag and drop GSSDKCore.xcframework, and optionally GSSDKScanFlow.xcframework and GSSDKOCR.xcframework into the Frameworks, Libraries and Embedded Content of your app’s target.

Make sure that Embed & Sign is properly specified:

With CocoaPods

If you already use CocoaPods, you can use the Genius Scan SDK as a Pod. Just add the following line to your existing Podfile (Make sure you specify the correct SDK location)

pod 'GSSDK', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-4.0.0-beta10.podspec'

The SDK is modular, so you can also include only the desired subspec: Core, OCR or ScanFlow:

pod 'GSSDK/Core', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-4.0.0-beta10.podspec'
pod 'GSSDK/OCR', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-4.0.0-beta10.podspec'
pod 'GSSDK/ScanFlow', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-4.0.0-beta10.podspec'

Configure your license key

The Genius Scan SDK is subject to a commercial license: a license key is needed to initialize the SDK. The key must match your application identifier (aka. bundle ID) and the license’s expiration date. Please contact us if you don’t have a license key yet.

The SDK can run without a license key but will stop working after 60 seconds.

You initialize the SDK with your license key as follow:

Objective-C
NSError *error = nil;
if (![GSK initWithLicenseKey:@"<YOUR LICENSE KEY>" error:&error]) {
    NSLog(@"Error while initializing the Genius Scan SDK: %@", error);
}
Swift
do {
    try GSK.initWithLicenseKey("<YOUR LICENSE KEY>")
} catch {
    NSLog("Error while initializing the Genius Scan SDK: \(error)")
}

If the key is invalid or your license is expired, the initialization raises an error, and the SDK will not work. A good practice is to check if the initialization succeeds; if not, you can take an appropriate workaround (e.g., disable the feature, prompt the user to update the application).

Note about the sample apps: if you have a license key, you can use it for the sample apps, but make sure you change the bundle ID of the sample app to match the bundle ID associated with your license key.

Configure your app

Your app is going to need the user’s permission to access the camera. You need to specify the reason for requesting this permission as part of the NSCameraUsageDescription in the Info.plist.

Next steps

Once you have done this, you’re ready to start your actual implementation. The next steps will depend whether you chose the simple integration, using the ScanFlow module, or if you are going for a custom integration.

© 2020 The Grizzly Labs, Inc. All rights reserved.