Extracting binary data from QR-code with zbar
I am not sure what those bytes represent, probably zbar is trying to interprete the bytes as a UTF-8 string even though the QR is in byte mode.
Switching to zxing fixed everything, there is no interleaved unexpected byte and the raw data contains the entire QR code including the mode, terminator, padding etc... Also it seems to never fails, while zbar seemed to fail sometime.
AVFoundation stop after successful scan
Try this in your delegate method
func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) {
if metadataObjects == nil || metadataObjects.count == 0 {
qrCodeFrameView?.frame = CGRect.zero
return
}
let metadataObj = metadataObjects[0] as! AVMetadataMachineReadableCodeObject
if supportedBarCodes.contains(metadataObj.type) {
let barCodeObject = videoPreviewLayer?.transformedMetadataObject(for: metadataObj)
qrCodeFrameView?.frame = barCodeObject!.bounds
print(metadataObj.stringValue)
// Stop capture session
videoPreviewLayer?.isHidden = true
qrCodeFrameView?.isHidden = true
self.captureSession?.stopRunning()
}
Can not get info out of generated QRCode
QR Codes holds lots of data based on these parameters.
- Data type
- Size a.k.a pixels
- Error correction level
Data type can be Numeric, Alphanumeric and Binary.
Error correction level can be categorised as Type L,M,Q and H based on loss recovery possible.
so as per your case you want to generate 30*30 alphanumeric so obviously you cant store more then allowed values. So make it bigger or reduce the data. To make a note all the QR code readers are not same.
For more info check this table
Related Topics
How to Access User Defined Runtime Attribute from the 'Sender' Object
Making Uitableview with Embedded Uicollectionview Using Uitableviewautomaticdimension
How to Unit Test an App Extension on Xcode 6
Using Two Versions of a Cocoapod Dependency
Game Engine Collison Bitmask... Why 0X01 etc
How to Show Specific Language Keyboard When User Input Values in Uitextfield in iPhone App
Uiview Drawrect: Draw the Inverted Pixels, Make a Hole, a Window, Negative Space
All Notifications Disappearing After Opening One of Them
Initializing Swift Properties That Require "Self" as an Argument
Using Wcsession with More Than One Viewcontroller
iOS - Using Uisearchdisplaycontroller with Uisearchbar That Is Uibarbuttonitem in Uitoolbar
Show Data in Uipickerview Second Component Based on First Component Selection
Nsindexpath? Does Not Have a Member Name 'Row' Error in Swift
Breaking on Unrecognized Selector
Dequeuereusablecellwithidentifier:Forindexpath: VS Dequeuereusablecellwithidentifier:
Private VS. Fileprivate on Declaring Global Variables/Consts in Swift3