从 Info.plist 中删除没有数据的密钥

Remove keys without data from Info.plist

我有一个 iOS 应用程序,在 Info.plist

中有以下键
<key>UISupportedExternalAccessoryProtocols</key>
    <array>
        <string>$(MYAPP_EXTERNAL_ACCESSORIES)</string>
    </array>

我们有应用程序的客户端和商家版本,只有后者在此处获得分配值(蓝牙打印机)。为客户端存档时,我们在上传到iTunes Connect的过程中出现以下错误:

ERROR ITMS-90110: "This bundle is invalid. The key UISupportedExternalAccessoryProtocols in the Info.plist file must be an array of non-empty strings."

我找到了使用脚本更改 Info.plist 的方法(adding/removing 来自现有密钥的内容),但没有找到如何为某些构建配置完全删除密钥,或者如果它是空的。

最好的解决方案是什么?

谢谢。

您表示您已经知道如何使用构建脚本。您要在脚本中使用的工具是 plutil:

plutil -insert <keypath> -<type> <value> <path_to_file>

plutil -remove <keypath> <path_to_file>