Deprecation warning

Please note that this is outdated documentation for an older release of the Scandit Barcode Scanner SDK.

We are deprecating the 5.x API on all platforms (except Linux). Release 5.19 in April 2021 will be our final. Applications running 5.x will continue to work, and we will continue to release critical bug fixes and security patches only, for one year. We encourage you to migrate to 6.x and take advantage of our latest / advanced features and improved performance.

You'll find the updated documentation at: Data Capture SDK Documentation for iOS

Scanning Multiple Barcodes

Motivation

Sometimes you can find several barcodes in the same package/pallet, with the Scandit Barcode Scanner you can scan all the codes at the same time, saving time and money. With very little code it is possible to get it.

Steps

To implement multiple barcode scanning

  • Set the code duplicated filter SBSScanSettings::codeDuplicateFilter to -1, so each unique code is only added once to the session.
  • Set the maximum number of codes to be decoded every frame SBSScanSettings::maxNumberOfCodesPerFrame
  • In the SBSScanDelegate::didScan function, wait unil the number of expected codes have been decoded, then store the codes and pause and clean the session.
SBSScanSettings* scanSettings = [SBSScanSettings defaultSettings];
//barcodes are filtered as duplicates
//if they match an already decoded barcode in the session
scanSettings.codeDuplicateFilter = -1;
//the maximum number of codes to be decoded every frame
scanSettings.maxNumberOfCodesPerFrame = 3;
#pragma mark - SBSScanDelegate
- (void)barcodePicker:(SBSBarcodePicker *)picker didScan:(SBSScanSession *)session {
// number of expected barcodes
int numExpectedCodes = 3;
// get all the scanned barcodes from the session
NSArray *allCodes = session.allRecognizedCodes;
// if the number of scanned codes is greater or equal than the number of expected barcodes
// pause the scanning and clear the session (to remove recognized barcodes).
if ([allCodes count] >= numExpectedCodes) {
// pause scanning and clear the session. The scanning itself is resumed
// when the user taps the screen.
[session pauseScanning];
[session clear];
}
}