Add the SDK to Your App#

This guide shows you how to add the Scandit Data Capture SDK to current existing project.

Prerequisites#

  • The latest stable version of Xcode.

  • An iOS project with minimum iOS deployment target of 9.0 or higher.

  • A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com/customers/new?p=test.

Get a License Key#

  1. If you don’t have a scandit account yet, create a free test account at ssl.scandit.com/customers/new?p=test.

  2. Sign in to your account at ssl.scandit.com/sessions/new.

  3. Select “License Keys” from the left-hand menu

  4. If you don’t have a license key for your app yet, click “Create native SDK license key” and enter the bundle ID for your project.

  5. Copy the license key.

Should you have a paid subscription, please reach out to support@scandit.com if you need a new license key.

Add the SDK#

Currently we support two ways to integrate the Scandit Data Capture SDK. The simplest way is to use CocoaPods, alternatively you can manually add the dynamic framework to your project.

Add the Frameworks via CocoaPods#

Add the frameworks you want to add in your Podfile. For instance, to add ScanditBarcodeCapture API add

pod 'ScanditBarcodeCapture', '~> 6.1'

The previous line will also download ScanditCaptureCore API, since ScanditBarcodeCapture API depends on it.

If you want to install a specific version, you can do so by specifying the version explicitly. For instance:

pod 'ScanditBarcodeCapture', '6.1.2'

Using a specific version is necessary when you want to install a beta version.

Add the Frameworks Manually#

Adding the frameworks manually is a three step process. First you need to add the frameworks to your project. Drag the frameworks into the Embedded Binaries section of your target. Please note that you will always need at least ScanditCaptureCore.framework which contains the shared functionality used by the other data capture modules.

_images/embedded-binaries.png

The next step is to strip some invalid architectures. Usually, iOS frameworks contain a fat binary with simulator (i386/x86_64) and device (ARM) slices. When you want to submit your app to the App Store, you should strip the simulator slices. In this step we will be stripping these slices. Add a new Run Script Phase in your target’s Build Phases (make sure it’s below the Embed Frameworks build phase).

Paste the following line in the script text field of Run Script Phase:

bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/ScanditCaptureCore.framework/strip-frameworks.sh"
_images/strip-frameworks.png

The last step is optional, but it is recommended for debugging and crash reporting. For each framework, add the corresponding dSYM file to the project (i.e. ScanditCaptureCore.framework.dSYM). Please note that the dSYM files should not be added to any target.

_images/add-dSYMs.png

Add the dSYM files as input files of the Run Script Phase. Make sure you specify the correct path ($(SRCROOT) is the path to the directory containing the Xcode project).

_images/copy-dSYMs.png

Now the debug symbols will be part of the final archive.

Note

When building the project, by default XCode will look for the frameworks in the root folder of the project.

If you choose to copy the frameworks in a different location, don’t forget to update the FRAMEWORK_SEARCH_PATHS build setting accordingly.

_images/update-framework-search-paths.png

Import the Frameworks in your Source Code#

In the files in which you need to use the frameworks, add the import statements at the top. In Swift:

import ScanditCaptureCore
import ScanditBarcodeCapture

In Objective-C:

@import ScanditCaptureCore;
@import ScanditBarcodeCapture;

Create a Test License Key#

  1. Sign in to your account at ssl.scandit.com/sessions/new.

  2. Select “License Keys” from the left-hand menu

  3. Click “Create native SDK license key” and enter the bundle ID for your project.

Should you have a paid subscription, please reach out to support@scandit.com if you need a new license key.

Additional Information#

  • Remember that, if you want to use the camera as the frame source for barcode, text and label capture, you need to set the “Privacy - Camera Usage Description” field in the Info.plist file.

Next steps#

You are now ready to tackle the following guides: