Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang Risk warning from Xcode in CBScanner.swift #66

Open
Binzinz opened this issue Sep 30, 2022 · 3 comments
Open

Hang Risk warning from Xcode in CBScanner.swift #66

Binzinz opened this issue Sep 30, 2022 · 3 comments

Comments

@Binzinz
Copy link
Contributor

Binzinz commented Sep 30, 2022

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

@hamzasohail
Copy link

hamzasohail commented Oct 14, 2022

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.

@Binzinz
Copy link
Contributor Author

Binzinz commented Oct 14, 2022

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

nobbes added a commit to nobbes/PayForMe that referenced this issue May 22, 2023
Except in CBScanner.swift from third-party barcode scanner, issue is open: heart/CarBode-Barcode-Scanner-For-SwiftUI#66
@amos-yau
Copy link

amos-yau commented Jan 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants