Integrate the Scandit Barcode Scanner into your own app by following these 6 steps:
Download the Scandit Barcode Scanner library
Choose a plan (e.g.,“Consumer Apps”, "Professional Apps", or “Enterprise/OEM” plan) at http://www.scandit.com/pricing, activate your account and log in. Go to the Download section and download the Barcode Scanner for iOS.
Add other required frameworks to your Xcode project
The Scandit Barcode Scanner needs multiple frameworks that might not be part of your Xcode project yet. Add all the frameworks and libraries that are listed:
- libc++.tbd
- libiconv.tbd
- libz.tbd
- CoreText.framework
- OpenGLES.framework
- MessageUI.framework
- CoreVideo.framework
- UIKit.framework
- Foundation.framework
- CoreGraphics.framework
- AudioToolbox.framework
- AVFoundation.framework
- CoreMedia.framework
- QuartzCore.framework
- SystemConfiguration.framework
- MediaPlayer.framework
Add the scanner framework to your project
Unpack the downloaded ZIP file and open the folder named ScanditSDK, it contains the ScanditBarcodeScanner framework. Drag and drop the framework into your Xcode project. Make sure to select "Copy items if needed" to copy the framework into your project's folder.
The framework contains resources that you have to link to in the project. For this right click on the ScanditBarcodeScanner framework inside your project and select "Show in Finder". Go to ScanditBarcodeScanner.framework/Resources and drag and drop ScanditBarcodeScanner.bundle into your Xcode project. In the end it should look the following way:
Integration in a Swift project
If you are using Swift to develop your app, you can import the framework as follows:
Integration in an Objective-C project
If you are using Objective-C to develop your app, you can import the framework's headers as follows:
Set the license key
Sign in to your account at http://account.scandit.com to look up your license key in the License Keys section.
Set the license key in your AppDelegate's applicationDidFinishLaunching method the following way:
Objective-C:
Swift:
Add code to handle the scanning event
Implement the SBSScanDelegate protocol to handle the successful barcode decoding. The API reference of the SBSScanDelegate protocol provides more details about what is returned.
Careful: The SBSScanDelegate method2 is invoked on a picker-internal queue. To perform any UI work, you must dispatch to the main UI thread.
Objective-C:
Swift:
If you are displaying the SBSBarcodePicker modally and want to use the scanner's toolbar to cancel and return you will also need to implement the SBSOverlayControllerDidCancelDelegate.
Objective-C:
Swift:
Add code to start the scanning process
The scanning process is started by instantiating SBSBarcodePicker, specifying the delegate that will receive the scan callback event and then starting the scanner.
Objective-C:
Swift:
Next steps
- Experiment with the extended demo app that allows to set all Scandit Barcode Scanner API options
- Show the scanner
- Customize the scan UI
- Select one barcode among many
- Use the Scandit Scan Case in your app