1

I am using this code to detect the barcode . The code is

- (IBAction) scanButtonTapped
{
    NSLog(@"TBD: scan barcode here...");
// ADD: present a barcode reader that scans from the camera feed
    ZBarReaderViewController *reader = [ZBarReaderViewController new];
    reader.readerDelegate = self;
    reader.supportedOrientationsMask = ZBarOrientationMaskAll;

    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];

    // present and release the controller
    [self presentModalViewController: reader
                            animated: YES];
    [reader release];
}

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    // ADD: get the decode results
    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
    resultText.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*!)

    [reader dismissViewControllerAnimated:YES completion:nil];
}

It is working fine on these links but If I place my ipod touch camera on the realbarcodes like lays packet,iPhone cases ... it is not detecting . Please tell me how to solve this Problem .Thanks in advance. Any Ideas would be appreciated . Let me know if my question not clear .

sri
  • 227
  • 2
  • 12
  • It may be the way you wrote it, but it sounds like you are physically placing the ipod touch on the lays packet. Is this right? – Peter M Dec 20 '12 at 13:21
  • I have edited my question and pasted all the code . I have placed after I launch the iPod Camera – sri Dec 20 '12 at 13:25
  • have you set the correct type of bar code you are scanning as ZBar can be set to detect different type of barcode for eg we have Code-39,Code- 128 etc. – spider1983 Dec 20 '12 at 13:43
  • How are you scanning the bar code. Did you start off with the camera pointing away from the barcode or did you start the camera pointing at the barcode? Starting the camera at the barcode can cause the scanner to keep scanning. – Zhang Dec 21 '12 at 08:13

0 Answers0