2

I am using QR code sdk to scan for QR codes, but problem is that it is working on camera not on simulator. I tried a lot over the net but doesn't find any perfect working solution. Can anyone guide me for this. Thanks in advance.

iPhone Programmatically
  • 1,211
  • 2
  • 22
  • 54
  • I want to fetch image from photo library, by default app opens camera and captures image and then scans to get its codes, and i want it to use library rather than camera. But i am unable to do so yet, that's why looking for some help. – iPhone Programmatically Sep 29 '12 at 06:18

2 Answers2

1

Create the reader.

This is as simple as creating a new ZBarReaderController:

ZBarReaderController *reader = [ZBarReaderController new];

Setup a delegate to receive the results.

The delegate should implement the ZBarReaderDelegate protocol, which inherits from UIImagePickerControllerDelegate:

reader.readerDelegate = self;

Configure the reader.

You will need to set the sourceType appropriately. Aside from the properties of the reader itself, you can configure the decoder via the scanner property:

if([ZBarReaderController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) reader.sourceType = UIImagePickerControllerSourceTypeCamera; [reader.scanner setSymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0];

Follow these steps and never forget to accept right answers :)

Baig
  • 4,737
  • 1
  • 32
  • 47
  • That i have already tried and got error: Assertion failure in -[ZBarReaderViewController setSourceType:], /Users/spadix/zbar/hg/sdk/iphone/ZBarReaderViewController.m:650 – iPhone Programmatically Sep 29 '12 at 06:45
0

if you are geting problem in ZBar.

Then you can use ZXindWidget for scaning.

here is link you may refer for this

Link