Skip to content

Commit dc3675e

Browse files
lucasfernogSir-Thom
authored andcommitted
feat(barcode-scanner): validate missing Info.plist configuration (tauri-apps#1758)
1 parent edb9de5 commit dc3675e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"barcode-scanner": patch
3+
---
4+
5+
Validate missing `NSCameraUsageDescription` Info.plist value.

plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
262262

263263
self.invoke = invoke
264264

265+
let entry = Bundle.main.infoDictionary?["NSCameraUsageDescription"] as? String
266+
267+
if entry == nil || entry?.count == 0 {
268+
invoke.reject("NSCameraUsageDescription is not in the app Info.plist")
269+
return
270+
}
271+
265272
var iOS14min: Bool = false
266273
if #available(iOS 14.0, *) { iOS14min = true }
267274
if !iOS14min && self.getPermissionState() != "granted" {

0 commit comments

Comments
 (0)