Installation

Scanbot SDK is available via Cocoapods, embeddable framework or XCFramework. It contains all iOS supported 32 and 64 bit simulator and device architectures as well as bitcode.

Scanbot SDK can be used with Objective-C as well as Swift.

Please find the Scanbot SDK downloads here

For machine readable zone recognition, text recognition and machine learning based documentation detection additional data bundles are required in your project. You can include these bundles by adding them to your app’s bundle.

Note: Scanbot SDK also contains a script that prepares the standard framework and your app when archiving your app for submission to the App Store. It strips the unnecessary architectures from the framework’s binary, code signs the framework and adds the crash symbols (dSYM) file to your app’s archive (Embeddable framework only!).

1. Installation using CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C projects for macOS as well as iOS. It integrates deeply into your Xcode project and manages the third-party components in your app.

  • 1. If not already done, install CocoaPods on your Mac
  • 2. Add pods to your Xcode project as described in this guide
  • 3. Modify your podfile to include ScanbotSDK as described here

Open your podfile in Xcode or with any text editor and add the following line:

pod 'ScanbotSDK'

Your podfile should now read as follows:

target 'SDKPodTest' do
  use_frameworks!
  pod 'ScanbotSDK'
end

Save the podfile and run the following command in your project’s folder using the macOS Terminal:

$ pod install

Open your application’s Xcode workspace (not the project file) - you should now be able to use Scanbot SDK in your project.

1.1. Additional data bundles

For some Scanbot SDK features you will require additional data bundles. These bundles are contained in the pod but, by default, they are not added to your application’s bundle.

To use these additional bundles edit your podfile and add one or more of the following subspecs to the Scanbot SDK pod:

  • For optical Text recognition: [OCR]
  • For machine readable zone recognition: [MRZ]
  • For machine-learning-based document detection (from iOS 11.2): [MLDETECT]
  • For all features: [ALL]

Your podfile should now look similar to this:

target 'SDKPodTest' do
  use_frameworks!
  pod 'ScanbotSDK', :subspecs => ['OCR']
end

When using multiple subspecs:

target 'SDKPodTest' do
  use_frameworks!
  pod 'ScanbotSDK', :subspecs => ['OCR', 'MRZ', 'MLDETECT']
end

When using all subspecs:

target 'SDKPodTest' do
  use_frameworks!
  pod 'ScanbotSDK', :subspecs => ['ALL']
end

Whenever you change your podfile you must update the pods using the following command in your project’s folder using the macOS Terminal:

$ pod update

Hint: Do not use subspecs if not needed, the additional bundles will enlarge your app’s file size by a good amount.

Caution: CocoaPods version >= 1.5 is required to handle subspec-switching correctly.

2. Installation as an embeddable framework

Installing the Scanbot SDK embedded framework is really easy. Check out our step-by-step guide.

#import <ScanbotSDK/ScanbotSDK.h>

or

@import ScanbotSDK;

2.1. Step-by-step framework installation guide

Step 1 Copy ScanbotSDK folder into your apps project folder Copy the downloaded ScanbotSDK folder into your app’s project folder.

Step 2 Open your app project in Xcode Open your app project in Xcode.

Step 3 Drag the framework into your project. Navigate into the ScanbotSDK folder and drag ScanbotSDK.framework into your project’s ‘Frameworks, Libraries and Embedded Content’ section.

Step 4 Add a runscript build phase Add a runscript build phase to strip out simulator architectures from the SDK.

Script code:

bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/ScanbotSDK.framework/strip-SBSDK-Framework.sh"

Script input file:

$(SRCROOT)/./ScanbotSDK/ScanbotSDK.framework.dSYM

Step 5 Install the additional data bundles if required.

3. Installation as an embeddable XCFramework (XCode 11+ only)

Installing the Scanbot SDK embedded XCFramework is similar to using the framework, except for the strip script which is not needed with XCFrameworks. Check out our step-by-step guide.

#import <ScanbotSDK/ScanbotSDK.h>

or

@import ScanbotSDK;

3.1. Step-by-step XCFramework installation guide

Step 1 Copy ScanbotSDK folder into your apps project folder Copy the downloaded ScanbotSDK folder into your app’s project folder.

Step 2 Open your app project in Xcode Open your app project in Xcode.

Step 3 Drag the XCFramework into your project. Navigate into the ScanbotSDK folder and drag ScanbotSDK.xcframework into your project’s ‘Frameworks, Libraries and Embedded Content’ section.

Step 4 Install the additional data bundles if required.

4. Install additional data bundles if needed (Framework and XCFramework)

Step 1 Navigate to Build Phases In your XCode project navigate to Build Phases.

Step 2 Navigate to AdditionalData folder In Finder navigate to the AdditionalData folder.

Step 3 Drag needed bundles Drag the required data bundles to the ‘Copy Bundle Resources’ section.