Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-13264 (iOS): Remove ios usage descriptions #295

Closed
wants to merge 1 commit into from
Closed
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
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` if trying to access privacy-sensitive data. When the system prompts the user to allow access, this usage description 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` if trying to access privacy-sensitive data. When the system prompts the user to allow access, this usage description 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