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.

Get a License Key#

  1. If you don’t have a Scandit account yet, create a free test account at ssl.scandit.com.

  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.

If 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 three ways to integrate the Scandit Data Capture SDK. The simplest way is to use CocoaPods, alternatively, you can use Carthage or 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', '~> |shortversion|'

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', '|version|'

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

Add the Frameworks via Carthage#

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

binary "https://ssl.scandit.com/sdk/download/carthage/ScanditBarcodeCapture.json"

You also need to add ScanditCaptureCore API, since ScanditBarcodeCapture API depends on it.

binary "https://ssl.scandit.com/sdk/download/carthage/ScanditCaptureCore.json"

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

binary "https://ssl.scandit.com/sdk/download/carthage/ScanditBarcodeCapture.json" == |version|

Add the Frameworks via Swift Package Manager#

Add the frameworks you want to add in the Swift Packages section of your project. For instance, to add ScanditBarcodeCapture API add

https://github.com/Scandit/datacapture-spm-barcode.git

or if you prefer checking out git repositories via ssh

git@github.com:Scandit/datacapture-spm-barcode.git

You also need to add ScanditCaptureCore API, since ScanditBarcodeCapture API depends on it.

https://github.com/Scandit/datacapture-spm-core.git

or

git@github.com:Scandit/datacapture-spm-core.git

If you want to install a specific version, you can do so by specifying the version explicitly when adding the Package.

_images/add-swift-package-manager.jpg

Add the Frameworks Manually#

Adding the frameworks manually is a single step process when using the XCFramework archives.

All you need to do is drag the frameworks into the Frameworks, Libraries, and Embedded Content section of your target. Make sure to select “Embed and Sign” for the Embed option.

Please note that you will always need at least ScanditCaptureCore.xcframework which contains the shared functionality used by the other data capture modules.

_images/embedded-binaries.png

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.jpg

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;

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: