Skip to main content

iOS Barcode Scanner SDK - Getting Started

Requirements

Minimum deployment target: iOS 13.0

Supported architectures:

  • XCFramework (Download, Cocoapods, SPM): iPhoneOS arm64, iPhoneSimulatorOS arm64 and x86_64
  • Framework (Download): iPhoneOS arm64 and iPhoneSimulatorOS x86_64

Bitcode is no longer supported by Apple and has therefore been removed from Scanbot SDK

Compatible programming languages: Objective-C and Swift

Distribution

ScanbotBarcodeScannerSDK is available as an XCFramework, as a static framework (deprecated), via Swift Package Manager (SPM) and via Cocoapods.

Please note

Use one of the XCFrameworks if possible. XCFrameworks contain all supported architectures and are thinned automatically when uploading your app to appstoreconnect.com. Frameworks are deprecated, due to their inability to run natively on Apple Silicon simulators. When uploading your app to appstoreconnect.com you must strip the framework's x86_64 architecture.

ScanbotBarcodeScannerSDK is published via

Installation

Installation using CocoaPods

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

  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 the ScanbotBarcodeScannerSDK pod as described here

Open your Podfile in Xcode or with any text editing application and add the following line:

pod 'ScanbotBarcodeScannerSDK'

Your Podfile should now read as follows:

target 'SDKPodTest' do
...
use_frameworks!
pod 'ScanbotBarcodeScannerSDK'
...
end

Save the Podfile and run the

$ pod install --repo-update

command in your project folder using the macOS Terminal.

Open your application's Xcode workspace (not the project file). You should now be able to use Scanbot Barcode Scanner SDK in your project.

Installation as an embedded XCFramework (XCode 11+ only)

Installing the ScanbotBarcodeScannerSDK XCFramework is very easy. Check out our step-by-step guide.

  1. Copy the folder containing ScanbotBarcodeScannerSDK.xcframework into your app's project folder
  2. Open your app project in Xcode
  3. Select your app's build target and drag the XCFramework into it

Step-by-step XCFramework installation guide

Step 1 Copy the folder containing ScanbotBarcodeScannerSDK.xcframework into your app's project folder Copy the folder containing ScanbotBarcodeScannerSDK.xcframework 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 ScanbotBarcodeScannerSDK folder and drag ScanbotBarcodeScannerSDK.xcframework into your project's 'Frameworks, Libraries and Embedded Content' section.

Import

Now you should be able to import the framework's umbrella header in your source code and start using it.

import ScanbotBarcodeScannerSDK

Installation via Swift Package Manager

The Barcode Scanner SDK provides the ability to be integrated into your app via the Swift Package Manager (more about Swift Packages).

Installation guide

Installation as an embedded framework

Also, you can install the ScanbotBarcodeScannerSDK manually as an embedded framework by applying the following steps:

  • Unzip the downloaded SDK archive file and copy the folder containing the ScanbotBarcodeScannerSDK.framework into your project folder
  • Open your project in Xcode
  • Select your build target and add an embedded framework
  • Select 'Add Other...'
  • Locate and select ScanbotBarcodeScannerSDK.framework
  • Check 'Copy items if needed' and 'Create groups', then hit 'Finish'
  • Add a runscript build phase that runs the strip-script and set the dSYM file as the input file to this runscript phase

Step-by-step guide

Step 1 Copy the folder containing the ScanbotBarcodeScannerSDK.framework into your project folder

Step 2 Open your project in Xcode. Select your build target and link to the framework

Step 3 Select 'Add Other...'

Step 4 Locate and select ScanbotBarcodeScannerSDK.framework

Step 5 Add a runscript build phase

Step 6 Configure the runscript build phase

Script code:

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

Script input file:

$(SRCROOT)/./ScanbotBarcodeScannerSDK/dSYMs/ScanbotBarcodeScannerSDK.framework.dSYM

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?