I need to integrate QR-code reader in app and found a tutorial for it.
I downloaded Z-bar sdk from this link.
Here is what I had done.
In the QRscann
You can use my own framework for QRCodeReader.
https://www.cocoacontrols.com/controls/qrcodereader
How to use
Paste "M1, M2" methods in your view controller (i.e. "ViewController.m")
"M1" viewDidLoad
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = @"QR Code Reader";
[qrCodeView setDelegate:self];
[qrCodeView startReading];
}
And here the delegate methods: "M2" QRCodeReaderDelegate
#pragma mark - QRCodeReaderDelegate
- (void)getQRCodeData:(id)qRCodeData {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"QR Code" message:qRCodeData preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:cancel];
UIAlertAction *reScan = [UIAlertAction actionWithTitle:@"Rescan" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[qrCodeView startReading];
}];
[alertController addAction:reScan];
[self presentViewController:alertController animated:YES completion:nil];
}
Thanks.