NSCameraUsageDescription problem in camera preview

Hi, I am using Camera Preview Plugin in my app.
and I’m testing my app in my iphone.

this repo says,

for iOS 10+,

<config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription" overwrite="true">
  <string>Allow the app to use your camera</string>
</config-file>

have to add my config.xml .

so i added.

    <platform name="ios">
        <config-file overwrite="true" parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
            <string>Allow the app to use your camera</string>
        </config-file>
        <allow-intent href="itms:*"/>
        <allow-intent href="itms-apps:*"/>
        <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
        <icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
        <icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
        <icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
        <icon src="resources/ios/icon/icon-40@3x.png" width="120" height="120"/>
        <icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
        <icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
        <icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
        <icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
        <icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
        <icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
        <icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
        <icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
        <icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
        <icon src="resources/ios/icon/icon-83.5@2x.png" width="167" height="167"/>
        <icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
        <icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
        <icon src="resources/ios/icon/icon-small@3x.png" width="87" height="87"/>
        <splash src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
        <splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/>
        <splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/>
        <splash src="resources/ios/splash/Default-Landscape-736h.png" width="2208" height="1242"/>
        <splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
        <splash src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" height="2048"/>
        <splash src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" height="768"/>
        <splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
        <splash src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" height="2732"/>
        <splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
        <splash src="resources/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
        <splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/>
    </platform>
    <engine name="android" spec="^6.2.3"/>
    <engine name="browser" spec="^4.1.0"/>
    <engine name="ios" spec="~4.4.0"/>
    <plugin name="cordova-plugin-camera-preview" spec="git+https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git"/>
    <plugin name="cordova-plugin-console" spec="^1.0.7"/>
    <plugin name="cordova-plugin-device" spec="^1.1.6"/>
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3"/>
    <plugin name="cordova-plugin-statusbar" spec="^2.2.3"/>
    <plugin name="cordova-plugin-whitelist" spec="^1.3.2"/>
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1"/>
</widget>

but it doesn’t work. my *-Info.plist doesn’t contain any codes about NSCameraUsageDescription.
I remove ios platform and re add it, but still does not work.
I don’t understand why it doesn’t…

Are you sure this goes inside <platform name="ios">?

1 Like

thanks for replying! I finally solved it. I just changed my Info.plist at Xcode. :slight_smile:

… which will get lost when you check out the project on another computer or have to regenerate the iOS platform for whatever reason.