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

Commit

Permalink
Merge pull request #623 from jcesarmobile/revert-usage-description
Browse files Browse the repository at this point in the history
Revert usage description changes
  • Loading branch information
jcesarmobile authored Mar 15, 2018
2 parents 6e88cbb + 46b925c commit 1b2aa76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 1b2aa76

Please sign in to comment.