Skip to content

Commit

Permalink
CB-13264 (iOS): Remove ios usage descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Oct 21, 2017
1 parent a6706ae commit 415c335
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,33 @@ Documentation consists of template and API docs produced from the plugin JS code

### iOS Quirks

Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` and `NSPhotoLibraryUsageDescription` in the info.plist.
Since iOS 10 it's mandatory to provide an usage description in the info.plist when trying to access privacy-sensitive data. When the system prompts the user to allow access, this string will displayed as part of the permission dialog box, but 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 user’s camera.
- `NSPhotoLibraryUsageDescription` describes the reason the app accesses the user's photo library.

When the system prompts the user to allow access, this string is displayed as part of the dialog box.
This plugins requires the following usage descriptions:

To add this entry you can pass the following variables on plugin install.
- `NSCameraUsageDescription` describes the reason that the app accesses the user's camera.
- `NSPhotoLibraryUsageDescription` describes the reason the app accesses the user's photo library.
- `NSLocationWhenInUseUsageDescription` describes the reason the app accesses the user's location. (Set it if you have `CameraUsesGeolocation` preference set to `true`)

- `CAMERA_USAGE_DESCRIPTION` for `NSCameraUsageDescription`
- `PHOTOLIBRARY_USAGE_DESCRIPTION` for `NSPhotoLibraryUsageDescription`
To add these entries into the info.plist, you can use the `edit-config` tag in the config.xml like this:

Example:
```
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>need camera access to take pictures</string>
</edit-config>
```

cordova plugin add cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION="your usage message" --variable PHOTOLIBRARY_USAGE_DESCRIPTION="your usage message"
```
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>need to photo library access to get pictures from there</string>
</edit-config>
```

If you don't pass the variable, the plugin will add an empty string as value.
```
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
```

---

Expand Down
32 changes: 21 additions & 11 deletions jsdoc2md/TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,33 @@ the system's image library.

### iOS Quirks

Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` and `NSPhotoLibraryUsageDescription` in the info.plist.
Since iOS 10 it's mandatory to provide an usage description in the info.plist when trying to access privacy-sensitive data. When the system prompts the user to allow access, this string will displayed as part of the permission dialog box, but 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 user’s camera.
- `NSPhotoLibraryUsageDescription` describes the reason the app accesses the user's photo library.

When the system prompts the user to allow access, this string is displayed as part of the dialog box.
This plugins requires the following usage descriptions:

To add this entry you can pass the following variables on plugin install.
- `NSCameraUsageDescription` describes the reason that the app accesses the user's camera.
- `NSPhotoLibraryUsageDescription` describes the reason the app accesses the user's photo library.
- `NSLocationWhenInUseUsageDescription` describes the reason the app accesses the user's location. (Set it if you have `CameraUsesGeolocation` preference set to `true`)

- `CAMERA_USAGE_DESCRIPTION` for `NSCameraUsageDescription`
- `PHOTOLIBRARY_USAGE_DESCRIPTION` for `NSPhotoLibraryUsageDescription`
To add these entries into the info.plist, you can use the `edit-config` tag in the config.xml like this:

Example:
```
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>need camera access to take pictures</string>
</edit-config>
```

cordova plugin add cordova-plugin-camera --variable CAMERA_USAGE_DESCRIPTION="your usage message" --variable PHOTOLIBRARY_USAGE_DESCRIPTION="your usage message"
```
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>need to photo library access to get pictures from there</string>
</edit-config>
```

If you don't pass the variable, the plugin will add an empty string as value.
```
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
```

---

Expand Down
14 changes: 0 additions & 14 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,6 @@
<framework src="CoreGraphics.framework" />
<framework src="AVFoundation.framework" />

<preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string>$CAMERA_USAGE_DESCRIPTION</string>
</config-file>

<preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>$PHOTOLIBRARY_USAGE_DESCRIPTION</string>
</config-file>

<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
<string></string>
</config-file>

</platform>

<!-- blackberry10 -->
Expand Down

0 comments on commit 415c335

Please sign in to comment.