IOS QR code scan through ZBar ZXing and other third-party libraries, zbarzxing
There are many open-source libraries for scanning QR codes, such as ZBar and ZXing.
How to Use ZBar:
Download ZBar SDK
Address https://github.com/bmorton/ZBarSDK
ZBarSDK is an open source SDK that implements the identification and reading of various bar codes, including EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code.
Step1. the framework to be imported using ZBarSDK
1. AVFoundation. framework
2. CoreMedia. framework
3. CoreVideo. framework
4. QuartzCore. framework
5. libiconv. dylib
Step 2 import # import "ZBarSDK. h" in ViewController. h"
Step3. implement the <ZBarReaderDelegate> protocol in ViewController. h.
Step 4. Write the Code:
-(IBAction) scan :( id) sender {
ZBarReaderViewController * reader = [ZBarReaderViewControllerNew];
Reader. readerDelegate = self;
Zbarimageworkflow * reader. Category = reader. category;
[Export setSymbology: ZBAR_I25 config: zbar_assist_enable to: 0];
Reader. showsZBarControls = YES;
[Self presentViewController: reader animated: YES completion: nil];
}
-(Void) ImagePickerController :( UIImagePickerController *) picker didFinishPickingMediaWithInfo :( NSDictionary *) info
{
Id <NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol * symbol;
For(Symbol in results)
Break;
_ ImageView. image = [info objectForKey: UIImagePickerControllerOriginalImage];
[Picker dismissViewControllerAnimated: YES completion: nil];
_ Label. text = symbol. data;
}