iPhone zXing QR Scanner - didscanresult function never fires

I have loaded the zXing project into my own project. It loads fine, the zXing scanner pops up after a button call.

I can dismiss the view controller on thezxingControllerDidCancel but when I scan a QR code, no codes are ever recognised and therefore the didScanResult function never fires.

Does anyone have any idea about this one?

The didScanResult function is below.

-(void)zxingController:(ZXingWidgetController *)controller didScanResult:(NSString *)result{
resultLabel.text = result;
NSLog(@"did scan!!!");
[self dismissModalViewControllerAnimated:NO];

}

Note: I'm not sure if this is relevant, but when the scanner comes up, I get this logged by the app: "wait_fences: failed to receive reply: 10004003"

Answers


That tutorial does not mention that you must add a QRCodeReader to the set of readers of your ZXingWidgetController.

ZXingWidgetController has a property called readers, which is an NSSet containing the instances of the readers (e.g. an instance of QRCodeReader). Roughly, the readers' task is to analyze the images your camera takes and to extract the encoded information. Your ZXingWidgetController has to know about the readers it should utilize, otherwise it has no chance to do anything meaningful. So you have to set the readers property before you present the ZXingWidget.

The ZXing project has a sample app which demonstrates this. If you use ARC, then

ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO];
QRCodeReader* qRCodeReader = [[QRCodeReader alloc] init];
NSSet *readers = [[NSSet alloc] initWithObjects:qRCodeReader,nil];
widController.readers = readers;
[self presentModalViewController:widController animated:YES];

should do.


Need Your Help

C# - Closest number to 0

c# numbers closest

I apologize if it sounds dumb, I am a beginner in programming.

PHP sessions without cookies

php html session cookieless

i'm a little lost working without cookies.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.