twostraws / CodeScanner

A SwiftUI view that is able to scan barcodes, QR codes, and more, and send back what was found.
MIT License
1.01k stars 286 forks source link

fixes #72 Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value #73

Closed uniqby closed 2 years ago

george-bh commented 2 years ago

@twostraws can this be merged?

twostraws commented 2 years ago

Yes – thank you!

dramikei commented 2 years ago

This fixes #68 FYI

ian-sayles commented 2 years ago

I keep getting something similar when user first runs app and is asked to give permission to access the camera. It crashes with the following error, this happens before the 'OK' button is pressed, if press the button, when start the app again it works fine.

CodeScanner/ScannerViewController.swift:178: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value 2022-08-12 09:30:14.185667+0100 [405:12472] CodeScanner/ScannerViewController.swift:178: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

if previewLayer == nil { previewLayer = AVCaptureVideoPreviewLayer(session: captureSession) }

The version of Codescanner 2.1.2 and iOS 15.6

nathanfallet commented 2 years ago

@twostraws Can you tag a new version (eg: 2.1.3) with this fix? (and then close #68 and #77)