Inconsistency barcode results using ZBarReaderViewController in ios

2013-04-04
2013-04-05
  • srinu ambati

    srinu ambati - 2013-04-04

    I am doing one iOS app in which I have to scan the barcodes . I have used ZBarReaderViewController for scanning the barcodes . Sometimes it is giving the result accurately but sometimes it is giving unknown value like this &7&#,Ac9 . My code is

    -(IBAction)scanBarCode:(id)sender
    {
    reader = [ZBarReaderViewController new];
    reader.readerDelegate = self;
    reader.supportedOrientationsMask = ZBarOrientationMaskAll;
    reader.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height * [UIScreen mainScreen].scale >= 1136)
    [reader.readerView setScanCrop:(CGRect){ { 0.25, 0.08 }, { 0.07, 0.84} }];//.25
    else
    [reader.readerView setScanCrop:(CGRect){ { 0.23, 0.08 }, { 0.09, 0.84} }];

    ZBarImageScanner *scanner = reader.scanner;
    // TODO: (optional) additional reader configuration here

    // EXAMPLE: disable rarely used I2/5 to improve performance
    /[scanner setSymbology: ZBAR_I25
    config: ZBAR_CFG_ENABLE
    to: 0]
    ;
    /

    //swetha test
    [scanner setSymbology: 0
    config: ZBAR_CFG_ENABLE
    to: 0]
    ;
    // Enable EAN 13
    [scanner setSymbology: ZBAR_EAN13
    config: ZBAR_CFG_ENABLE
    to: 1]
    ;
    // Enable UPC-A
    [scanner setSymbology: ZBAR_UPCA
    config: ZBAR_CFG_ENABLE
    to: 1]
    ;
    // Enable Code 128
    [scanner setSymbology: ZBAR_CODE128
    config: ZBAR_CFG_ENABLE
    to: 1]
    ;
    [self presentViewController:reader animated:YES completion:nil];
    [reader release];

    }

    • (void)imagePickerController:(UIImagePickerController )picker didFinishPickingMediaWithInfo:(NSDictionary )info
      {
      id<NSFastEnumeration> results =
      [info objectForKey: ZBarReaderControllerResults];
      ZBarSymbol *symbol = nil;
      for(symbol in results)
      // EXAMPLE: just grab the first barcode
      break;

      // EXAMPLE: do something useful with the barcode data
      serialnumber.text = symbol.data;

      // EXAMPLE: do something useful with the barcode image
      //resultImage.image =
      //[info objectForKey: UIImagePickerControllerOriginalImage];

      // ADD: dismiss the controller (NB dismiss from the reader!)
      barcodeClicked = 0;

      [picker dismissViewControllerAnimated:YES completion:nil];
      }

     
  • srinu ambati

    srinu ambati - 2013-04-05

    Hi all , Still I am facing the above issue . Please let me know . Any help would be appreciated .

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks