Skip to content

Commit

Permalink
fix(ios): prevent camera failure in silence (capacitor-community#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedropanos authored Mar 1, 2022
1 parent de5b6db commit 6165cc9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ public class BarcodeScanner: CAPPlugin, AVCaptureMetadataOutputObjectsDelegate {

private func scan() {
if (!self.didRunCameraPrepare) {
if (!self.hasCameraPermission()) {
//In iOS 14 don't identify permissions needed, so force to ask it's better than nothing. Provisional.
var iOS14min: Bool = false
if #available(iOS 14.0, *) { iOS14min = true; }
if (!self.hasCameraPermission() && !iOS14min) {
// @TODO()
// requestPermission()
} else {
Expand Down

0 comments on commit 6165cc9

Please sign in to comment.