Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Revert usage description changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Mar 13, 2018
1 parent b508cd3 commit 46b925c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -42,17 +42,15 @@ Note: Windows 10 applications can not be build for `AnyCPU` architecture, which
cordova run windows -- --archs=x86
```

Note: Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` in the `Info.plist`.
Note: Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` in the info.plist.

`NSCameraUsageDescription` describes the reason that the app accesses the user's camera.
When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.
`NSCameraUsageDescription` describes the reason that the app accesses the users camera.
When the system prompts the user to allow access, this string is displayed as part of the dialog box.

To add this entry you can use the `edit-config` tag in the `config.xml` like this:
To add this entry you can pass the following variable on plugin install.

```
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>To scan barcodes</string>
</edit-config>
cordova plugin add phonegap-plugin-barcodescanner --variable CAMERA_USAGE_DESCRIPTION="To scan barcodes"
```

### PhoneGap Build Usage
Expand All @@ -61,7 +59,9 @@ Add the following to your config.xml:

```
<!-- add a version here, otherwise PGB will use whatever the latest version of the package on npm is -->
<plugin name="phonegap-plugin-barcodescanner" />
<plugin name="phonegap-plugin-barcodescanner">
<param name="CAMERA_USAGE_DESCRIPTION" value="To scan barcodes." />
</plugin>
```
On PhoneGap Build if you're using a version of cordova-android of 4 or less, ensure you're building with gradle:
```
Expand Down
4 changes: 4 additions & 0 deletions plugin.xml
Expand Up @@ -18,6 +18,10 @@
<param name="ios-package" value="CDVBarcodeScanner"/>
</feature>
</config-file>
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>$CAMERA_USAGE_DESCRIPTION</string>
</config-file>
<preference name="CAMERA_USAGE_DESCRIPTION" default=" "/>
<resource-file src="src/ios/scannerOverlay.xib"/>
<resource-file src="src/ios/CDVBarcodeScanner.bundle"/>
<header-file src="src/ios/zxing-all-in-one.h"/>
Expand Down

0 comments on commit 46b925c

Please sign in to comment.