Cordova:从plugin.xml修改* -Info.plist [英] Cordova: Modifying *-Info.plist from plugin.xml

查看:1915
本文介绍了Cordova:从plugin.xml修改* -Info.plist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个外挂程式,使用iOS装置上的星号印表机,并使用






我得到的是:






相关问题:



我实现了 config-file 阅读这个问题。


  1. 通过Cordova config.xml将条目添加到iOS .plist文件

  2. 两个cordova插件修改* -Info.plistCFBundleURLTypes


解决方案

经过一些进一步的测试和研究,我发现如何写文件才能正常工作。这里是xml

 < config-file target =*  -  Info.plistparent =UISupportedExternalAccessoryProtocols> 
< array>
< string> jp.star-m.starpro< / string>
< / array>
< / config-file>

这里,我更改了父名称支持的外部附件协议 UISupportedExternalAccessoryProtocols 并删除< key> 标签,

I'm building a plugin to use star printers from an iOS device, with their SDK and everything is working fine except that config-file command to modify the info.plist file is not working properly. Inside my plugin.xml I have:

<config-file target="*-Info.plist" parent="Supported external accessory protocols">
  <array>
    <key>item 0</key>
    <string>jp.star-m.starpro</string>
  </array>
</config-file>

With that I should get a Supported external accessory protocols array with 1 item called item 0, type String and value jp.star-m.starpro but instead I'm getting an array with two items as if I would have done:

<array>
    <key>item 0</key>
    <string>item 0</string>
    <key>item 1</key>
    <string>jp.star-m.starpro</string>
</array>

What I need:


What I get:


Related questions:

I implemented the config-file by reading from this questions.

  1. Add entry to iOS .plist file via Cordova config.xml
  2. Two cordova plugins modifying "*-Info.plist" CFBundleURLTypes

解决方案

After some further testing and research, I found out how to write the config-file to work properly. Here is the xml

<config-file target="*-Info.plist" parent="UISupportedExternalAccessoryProtocols">
    <array>
        <string>jp.star-m.starpro</string>
    </array>
</config-file>

Here, I changed the parent name from Supported external accessory protocols to UISupportedExternalAccessoryProtocolsand remove the <key> tag and now works as expected.

这篇关于Cordova:从plugin.xml修改* -Info.plist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆