2016-05-17 24 views
9

我正在构建一个插件,使用iOS设备上的星形打印机,它们的SDK和一切正常,除了config-file命令修改info.plist文件是工作不正常。在我的的plugin.xml我:Cordova:从plugin.xml修改* -Info.plist

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

有了,我应该得到一个Supported external accessory protocols阵列1项名为item 0,类型String和价值jp.star-m.starpro而是我得到两个项目,就好像一个数组我会做:

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

我需要什么: one item


我得到什么: two items


相关问题:

我从这个问题读取执行的config-file

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

可以尝试此配置:<配置文件中目标= “* - Info.plist的” 父= “支持的外部附件协议”> 项0 jp.star米。 STARPRO Gandhi

+0

嗨@Gandhi,那会给我一个字符串数组内,一本字典所有项目0键里面我试了一下,无论如何,但它并没有活像ķ。 – Jose

+0

如何使用这个简化你的任务的插件 - https://github.com/dpa99c/cordova-custom-config – Gandhi

回答

4

经过进一步的测试和研究,我发现了如何写config-file正常工作。这里是XML

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

在这里,我从Supported external accessory protocols改父名UISupportedExternalAccessoryProtocols并删除<key>标签,现在按预期工作。

+0

嘿,何塞,你有没有分享你的插件?Github也许? –

+0

是@Żabojad,在https://github.com/auctifera-josed/starprnt – Jose

+0

谢谢乔斯! –

1

你可以看看这custom config plugin这应该只是你的任务。这有助于以您打算的方式操作* -info.plist文件。

+0

这看起来像一个有用的插件编辑从cordova应用程序info.plist,但(不知道我是否错过了)如何使用这从插件?因为那是我需要的。 – Jose

+0

@Jose它的一个插件本身用于操纵.plist文件。不知道我是否能正确理解你的问题 – Gandhi

+0

我需要做的是修改插件中的.plist文件,所以我不知道如何从另一个插件(我正在构建的插件)使用此插件 – Jose