Barcode Reader SDK for Mac iOS. Usage

This page breifly describe how to call SD-TOOLKIT Barcode Reader SDK for Mac iOS API from Object C application. For more details see the complete documentation included into the sdk

Reading Barcodes from Objective C application samples

Two classes are provided to access barcode recognition functionality: SDTBarcodeEngine and SDTBarcodeScannerViewController.

How to read barcode directly from cocoa UIImage

The major class to access barcode recognition functionality is SDTBarcodeEngine. To create instance of this class you have to call initWithLicense method passing a valid developer license as a parameter. Once barcode engine has been initiated call readImage method to read barcode symbols from image. The results are cached internally by SDTBarcodeEngine and can be accessed by getResultValueAtPos method. See below the SDTBarcodeEngine usage sample. A complete code you can find in the Samples folder of the SD-TOOLKIT Barcode SDK for iOS.
  1. Download the SDK dmg file
  2. Copy the downloaded Volume content to local drive
  3. Add lib/sdt-brc-ios2.a and include/SDTBarcodeEngine.h files to your XCode project
  4. Inside your application create Barcode Engine instance
    SDTBarcodeEngine* barcodeEngine = [[SDTBarcodeEngine alloc]
    initWithLicense:@"YOUR DEVELOPER LICENSE"];
  5. call readImage method passing the UIImage's CGImage instance
    [barcodeEngine readImage: [image CGImage]];
  6. call getResultValueAtPos method to get recognized value
    NSMutableString* resultValue = [[NSMutableString alloc] init];
    [barcodeEngine getResultValueAtPos:0 storeIn:resultValue];
  7. Destroy BarcodeEndine when done
    [barcodeEngine release]

How to read barcode from iPhone/iPad camera device in Objective C

The SDTBarcodeScannerViewController class starts Camera preview and scan barcodes on it. Once barcode has been recognized, the delegateís SDTBarcodeScannerViewControllerDelegate callback method onRecognitionComplete: will be called providing reference to SDTBarcodeEngine instance. Use the SDTBarcodeEngine instance to obtain information about recognized barcode and itís properties. In the example below textView and imageView are instances of UITextView and UIImageView . For complete sample sourcecode see sdt-brc-ios-sample3 project included into the sdk.
// protocol SDTBarcodeScannerViewControllerDelegate implementation
- (BOOL)onRecognitionComplete:(SDTBarcodeEngine*)theEngine 
                    orientation:(UIImageOrientation)theOrientation {
    if(theEngine != nil) {
        int resultCount = [theEngine getResultsCount];
        if(resultCount > 0) {
            NSMutableString* resultValue = [[NSMutableString alloc] init];
            [theEngine getResultValueAtPos:0 storeIn:resultValue];
            textView.text = resultValue;
            if(resultValue != nil) {            
                [resultValue release];
    if(theImage != nil) {
        imageView.image = [[UIImage alloc] initWithCGImage: theImage 
                                           scale: 1.0 
                                           orientation: theOrientation];
    //Returning YES will close scanner dialog
    return YES;