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,
Https://github.com/bmorton/ZBarSDKI'm using the Zbar QR code to scan the other SDK can alsoThe first is to import the library file:1.avfoundation.framework2.coremedia.framework3.corevideo.framework4.quartzcore.framework5.libiconv.dylibThis 5 library fileImport #import "ZBarSDK.h" in ViewController.h and inherit @property (Weak, nonatomic) Iboutlet Uiimageview *imageview;-(ibaction)
I'm using the Zbar QR code to scan the other SDK can alsoThe first is to import the library file:1.avfoundation.framework2.coremedia.framework3.corevideo.framework4.quartzcore.framework5.libiconv.dylibThis 5 library fileImport #import "ZBarSDK.h" in ViewController.h and inherit
123
@interface viewcontroller:uiviewcontroller @property (weak, Nonatomic iboutlet uiimageview *im
next, because using avfoundation has been unable to scan our QR code, and finally decided to use a barcode. I added the EAN13 barcode type (the type we used to generate the barcode) in Avcapturemetadataoutput's metadataobjecttypes, unfortunately, is still not recognized, but Baidu's other EAN13 types of barcodes can be identified, this issue is still unresolved. Finally, I decided to try Zbar,bingo!. The
Scan the QR code to enable one-click logon and one-click Logon
The first time I wrote a blog, I was very excited. I didn't know how to write it, so I could easily express it ......
Some time ago, I received a request saying that I would like to add a scan code login function on our project. Just like QQ and QQ, I immediately checked some information online, I fel
];Self.previewlayer = preview;6. Start session[Session startrunning];Self.session = session;}#pragma mark-Output proxy methodThis method is recognized in the QRCode, and the conversion is completedIf the content of the QRCode is larger, the longer the conversion takes-(void) Captureoutput: (Avcaptureoutput *) captureoutput didoutputmetadataobjects: (Nsarray *) metadataobjects Fromconnection: (avcaptureconnection *) connection{Frequent scans, invoking proxy methods1. If the
) { return; } [_capturesession stoprunning]; _running = NO;}Add two additional methods to start capture before the view is displayed, and stop capture when the app enters the background:-(void) Viewwillappear: (BOOL) animated{ [Super viewwillappear:animated]; [Self startrunning];} -(void) Viewwilldisappear: (BOOL) animated{ [Super viewwilldisappear:animated]; [Self stoprunning];}To modify the Viewdidload method, register the following two notifications: [[Nsnoti
1, build scan QR code interface. Storyboard can be used to build2. Create the object's controller class to manage the scan of QR code3. Import in this class #import Frame4. Call in Viewdidload1 [self setupqrcode];5, implement the above method- (void) setupqrcode{//1. Get input deviceAvcapturedevice *inputdevice =[Avca
For example, this site
Corn Net
Reply content:
For example, this siteCorn Net
/** * @descrpition Attention * @param $request * @return Array */public static function Eventsubscribe (A MP; $request) {$content = ' You are welcome to follow us, will serve you wholeheartedly '; return Responsepassive::text ($request [' Fromusername '], $request [' Tousername '], $content); }/** * @descrpition cancel attention * @param $request * @return Array */public static function Eventunsubs
dispatch queue for it, which prevents the main thread from blocking when the callback function is called.Next, declare this class to follow the Avcapturemetadataoutputobjectsdelegate agreement:@interface Viewcontroller () To implement the Proxy method:-(void) Captureoutput: (Avcaptureoutput *) captureoutput didoutputmetadataobjects: (Nsarray *) metadataobjects Fromconnection: (avcaptureconnection *) connection{ [Metadataobjects enumerateobjectsusingblock:^ ( Avmetadataobject *obj,
Mpaintshape.setalpha (0XFF/2) that draws the blinking point; Mpaintshape.setcolor (Pointcolor); Mpaintshape.setstyle (Paint.Style.FILL); Loop draw for (Resultpoint point:lastpoints) {//Draw Flicker Point canvas.drawcircle (scanhor Izontaldsitance + point.getx (), Scantopdistance + point.gety (), 3.0f, Mpaintshape); }}//Empty This data currentpoints.clear (); }Data source for flashing pointsThis method is automatically called internallypublic void A
Business Scenarioswhen a QR code scan is implemented ( with a zbar), sometimes the entire scanned image needs to be stored quietly, and (as Charles has some perverted business) that means a panoramic picture of the scanned picture. So how is the code implemented? I went to StackOverflow finally found the way to achieve! protected Previewcallback PREVIEWCB = new Previewcallback () {public void Onpreviewfra
Use Zxing to scan the QR code, zxing
1. Integrate Zxing. bar
2. Copy the code to the project.
3. Modify the scanning result method handleDecode () of MipacActivityCapture. java ()
/*** Process the scan result and redirect the activity page * @ param Result * @ param barcode */public void handleDecode (result Result, Bitmap barcode) {inactivityTimer. onActi
$ Total_amount = $ xmlArr ['total _ 0000']/100; // The amount in the xml file returned after callback is in units
$ Result_code = $ xmlArr ['result _ Code']; // status
If ($ result_code = 'success') {// database operation
// Process database operations, such as modifying the order status to recharge the account, etc.
Echo 'success '; // the SUCCESS of the return must be carried to the end. Otherwise, the callback will be performed eight times.
Exit;
} Else {// failed
Return;
Exit;
}
}
}
Templ
Added an api for ios7 to scan QR code
I used the ZBar open-source library to scan the QR code, but it seems that arm64 is not supported and is not being updated.
#import @interface QRCodeReadController : BaseViewControllervcapturemetadataoutputobjectsdelegate>@property (weak, nonatomic) IBOutlet UIView *viewPreview;@
Test addressHttp://39.106.12.24/DecodeQRCodeReal-time scan of the current network security does not realize,This is decoded after taking pictures.Qrcode.js more special, to my server up and downHttp://39.106.12.24/1Test/qrcode.js Mobile Web scan QR code
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.