Ionic 应用程序在信息 plist 文件中没有显示各种权限,尽管它们在 config.xml

Ionic app not showing various permissions in info plist file despite them being in config.xml

我的 config.xml 文件中有以下代码:

<platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
        <config-file parent="NSPhotoLibraryUsageDescription" target="*-Info.plist">
            <string>This app requires access to your photos so you may upload them as meals or feed posts.</string>
        </config-file>
        <config-file parent="NSCameraUsageDescription" target="*-Info.plist">
            <string>This app requires access to your camera so you may upload photos as meals or feed posts.</string>
        </config-file>
        <config-file parent="NSPhotoLibraryAddUsageDescription" target="*-Info.plist">
            <string>This app requires access to your photos so you may upload them as meals or feed posts.</string>
        </config-file>
        <config-file parent="NSLocationAlwaysAndWhenInUseUsageDescription" target="*-Info.plist">
            <string>This app requires access to your location so that you can post where you are on the feed.</string>
        </config-file>
        <config-file parent="NSLocationWhenInUseUsageDescription" target="*-Info.plist">
            <string>This app requires access to your location so that you can post where you are on the feed.</string>
        </config-file>
    </platform>

我有各种过去一直有效的配置文件键值对...但出于某种原因,现在当我进行 iOS 构建时,这就是我的 plist 文件的样子:

它只显示了照片库的条目,none 我的其他项目都在那里。难道我做错了什么?我在网上查找的所有内容似乎都在做我 config.xml 现在正在做的事情。

您应该使用 edit-config 而不是 config-file,它允许使用 merge 属性并允许您指定超过 1 个键

<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
    <string>Explanation</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryUsageDescription">
    <string>Explanation</string>
</edit-config>