Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

(ios) Added variable for setting NSCameraUsageDescription #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ The card.io Cordova Plugin adds support for the CardIO iOS and android platform.
1. Follow Your app integration section below.
2. Run `cordova run ios` or `cordova run android` to build and the project.

Note: For use with iOS 10 +
When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the <your app name>Info.plist file. Add the following lines in the main <dict> element.
## iOS Quirks

```xml
<key>NSCameraUsageDescription</key>
<string>To scan credit cards.</string>
```
Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` entry 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. To add this entry you can pass the variable `CARD_IO_CAMERA_USAGE_DESCRIPTION` on plugin install.

Example:
`cordova plugin add https://github.com/card-io/card.io-Cordova-Plugin --variable CARD_IO_CAMERA_USAGE_DESCRIPTION="your usage message"`

If you have a different way to edit .plist files - plugins etc. - you can do that.
If you don't pass the variable, the plugin will add a default string as value.

Sample HTML + JS
----------------
Expand Down
6 changes: 6 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
<framework src="UIKit.framework" />
<framework src="libc++.dylib" />

<!-- ios 10 camera usage description -->
<preference name="CARD_IO_CAMERA_USAGE_DESCRIPTION" default="${EXECUTABLE_NAME} Would like to use your camera to scan credit cards." />
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>$CARD_IO_CAMERA_USAGE_DESCRIPTION</string>
</config-file>

</platform>

<!-- android -->
Expand Down