Okay, I get it, possible duplicate of Read binary QR Code with AVFoundation but I'll try to tackle this issue from a different angle.
I'm trying to scan a barcode (in this case, Aztec) in my swift
app. It works for barcodes that have regular string data encoded. For my app though, I need to be able to scan a certain type of barcode (read more about this on SO) that stores the data in binary format.
Sadly, stringValue
of AVMetadataMachineReadableCodeObject
is (per Apple's docs)
The value of this property is an NSString created by decoding the binary payload according to the format of the machine-readable code
so the output gets garbled, truncated and unusable (It's a zlib
-encoded data stream).
My question is: is there a way to get to this binary payload other that stringValue
? Can I override part of AVMetadataMachineReadableCodeObject
and add my own binaryValue
or something like it.
I'm willing to try anything, but I'd love this to work natively without resorting to ZXing
or some other library, as this is a pretty compact project. If you know this to be working with a library, feel free to add a comment though.
Disclaimer: I'm coding this in Swift, but I think I could manage to abstract this from Obj-C code as well, if that is what you know.