CarBode-Barcode-Scanner-For-SwiftUI icon indicating copy to clipboard operation
CarBode-Barcode-Scanner-For-SwiftUI copied to clipboard

Hang Risk warning from Xcode in CBScanner.swift

Open Binzinz opened this issue 3 years ago • 3 comments

Xcode warns on this line: uiView.session?.startRunning() -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness

Binzinz avatar Sep 30 '22 09:09 Binzinz

There is explicit guidance by Apple to not call startRunning on the main thread though. See the text in the yellow box:

https://developer.apple.com/documentation/avfoundation/avcapturesession?language=objc

This suggests you shouldn't call it on the main thread.

hamzasohail avatar Oct 14 '22 03:10 hamzasohail

That's why I request a pull of the modification.

Binzinz avatar Oct 14 '22 07:10 Binzinz

Sorry I would like to know will this issue be fixed?

This thread would help, just add async background dispatch queue, right?

https://developer.apple.com/forums/thread/722309

amos-yau avatar Jan 01 '24 05:01 amos-yau