Vision Framework Tutorial for iOS: Scanning Barcodes | raywenderlich.com

In this Vision Framework tutorial, you’ll learn how to use your iPhone’s camera to scan QR codes and automatically open encoded URLs in Safari.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/12663654-vision-framework-tutorial-for-ios-scanning-barcodes

Relative newbie here!

In the processClassification method, what is the following code doing?

if captureSession.isRunning {
view.layer.sublayers?.removeSubrange(1…)

Thank you!

Is it possible to also save the image in addition to the barcode. We have a little app called HobbyDB Vision (‎hobbyDB Vision Funko Pop & Toy on the App Store) and it sends UPCs so we can verify our database as all the right information. Often we can’t find the UPC with a google search… it would be useful if the image was sent with the UPC, but I’m not sure how to capture the image… any advice would be appreciated. Thanks, Zack

How can I handle only scan in specific Cgrect with AVCaptureVideoDataOutput.
thank you.

@emadgnia I’m trying the second part of the tutorial in which to scan barcode and shows alert about the barcode. but, the app goes in crash.
he goes in processClassification, removeSubrange and because barcodes is empty jump out from loop for and goes in crash. how can I fix it?
the error is:Thread 1: EXC_BAD_ACCESS (code=1, address=0x4175134e86d0)

update: if I put a breakpoint in DispatchQueue.main.async i found the barcode array full with one element and app doesn’t go in crash.

How can I fix it?