Skip to content

Commit 6e0439d

Browse files
authored
Merge pull request #148 from jcesarmobile/CB-13265
CB-13265 Remove ios usage description from media plugin
2 parents 5dda706 + adb2363 commit 6e0439d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,19 @@ function recordAudio() {
566566

567567
var myMedia = new Media("documents://beer.mp3")
568568

569-
- Since iOS 10 it's mandatory to add a `NSMicrophoneUsageDescription` entry in the info.plist.
569+
- 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.
570570

571-
`NSMicrophoneUsageDescription` describes the reason that the app accesses the user’s microphone. 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 `MICROPHONE_USAGE_DESCRIPTION` on plugin install.
571+
This plugins requires the following usage description:
572572

573-
Example: `cordova plugin add cordova-plugin-media --variable MICROPHONE_USAGE_DESCRIPTION="your usage message"`
573+
* `NSMicrophoneUsageDescription` describes the reason that the app accesses the user's microphone.
574574

575-
If you don't pass the variable, the plugin will add an empty string as value.
575+
To add this entry into the `info.plist`, you can use the `edit-config` tag in the `config.xml` like this:
576+
577+
```
578+
<edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
579+
<string>need microphone access to record sounds</string>
580+
</edit-config>
581+
```
576582

577583
### Windows Quirks
578584

plugin.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ id="cordova-plugin-media"
106106
</config-file>
107107
<header-file src="src/ios/CDVSound.h" />
108108
<source-file src="src/ios/CDVSound.m" />
109-
<preference name="MICROPHONE_USAGE_DESCRIPTION" default=" " />
110-
<config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
111-
<string>$MICROPHONE_USAGE_DESCRIPTION</string>
112-
</config-file>
113109
</platform>
114110

115111
<!-- blackberry10 -->

0 commit comments

Comments
 (0)