如何将元素添加到 info.plist 数组?

Posted

技术标签:

【中文标题】如何将元素添加到 info.plist 数组?【英文标题】:How do I add elements to an info.plist array? 【发布时间】:2020-05-18 11:49:49 【问题描述】:

我在info.plist 中创建了一个array,现在我想在其中添加一些elements。认为就像添加string 属性并将其拖到array 一样简单,但不是。我什至尝试像这样将它添加到source,但随后它抱怨source 的结构不正确:

<key>myArray</key>
    <array>
        <key>myString</key>
        <string>myValue</string>
    <array/>

如何在source 中获得正确的结构,或者如何在属性列表中创建新的element

【问题讨论】:

一个数组没有key。它只是有一个重复的元素,在这种情况下string Key:value 是一个字典。 好的,但是我在 info.plist 中创建了一个数组并转到源代码,该数组的名称用 标记 【参考方案1】:

在info.plist文件中,如果你想输入一个数组,正确的格式是:

<key>Key name</key>
    <array>
        <string>some value</string>
        <string>some value</string>
        <string>some value</string>
        <string>some value</string>
        <string>some value</string>
    </array>

【讨论】:

以上是关于如何将元素添加到 info.plist 数组?的主要内容,如果未能解决你的问题,请参考以下文章

在构建之后(但在安装之前)向 Info.plist 数组添加值

在上传构建之前如何知道 info.plist 中缺少啥?

Xcode 将 DTXcode 密钥和其他密钥添加到 Info.plist

使用 XCODE 将 UIRequiredDeviceCapabilities 添加到 info.plist [重复]

如何在 iOS 的 info.plist 中添加属性

如何在 iOS 的 info.plist 中添加属性