修改“* - Info.plist”的两个cordova插件CFBundleURLTypes [英] Two cordova plugins modifying "*-Info.plist" CFBundleURLTypes

查看:1327
本文介绍了修改“* - Info.plist”的两个cordova插件CFBundleURLTypes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个cordova插件修改CFBundleURLTypes:
第一个:

I have 2 cordova plugins that are modifying CFBundleURLTypes: The first one:

<config-file target="*-Info.plist" parent="CFBundleURLTypes">
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>$URL_SCHEME</string>
      </array>
    </dict>
  </array>
</config-file>

第二个:

<config-file target="*-Info.plist" parent="CFBundleURLTypes">
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fb$APP_ID</string>
      </array>
     </dict>
  </array>
</config-file>

只有添加的第一个插件是修改* -Info.plist。

Only the first plugin that is added is modifying the "*-Info.plist".

有没有办法使两个插件都附加-Info.plist文件?

Is there a way to make both plugins to be appending -Info.plist file?

推荐答案

在Cordova 3.6.3-0.2.13中,正在添加这两个配置值,但是以这种方式:

On Cordova 3.6.3-0.2.13, both configuration values are being added but in this manner:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb12345678</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>anotherUrlScheme</string>
        </array>
    </dict>
</array>

在Cordova 4.0及更高版本(4.0.0,4.1.2,4.2.0)添加的插件的配置值将被忽略。因此,plist将看起来像(假设facebook插件get是第一添加):

On Cordova 4.0 and up (4.0.0, 4.1.2, 4.2.0), the second added plugin's configuration values will just get ignored. Thus, the plist will look like (Assuming facebook plugin get's added first):

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb12345678</string>
        </array>
    </dict>
</array>



< APP_ID),并为URL SCHEME插件创建另一个。我们检出了facebook的插件来源,以便能够修改源代码,并从这个目录添加了插件,而不是从GIT。

As a workaround, we modified the facebook plugin to add two URL schemes, one from APP_ID (fb$APP_ID) and created another one for the URL SCHEME plugin. We checked-out facebook plugin source to be able to modify the source, and added the plugin from this directory instead of getting from GIT.

在phonegap-facebook-plugin的插件.xml:

In phonegap-facebook-plugin's plugin.xml:

<config-file target="*-Info.plist" parent="CFBundleURLTypes">
    <array>
        <dict>
          <key>CFBundleURLSchemes</key>
          <array>
            <string>fb$APP_ID</string>
            <string>$URL_SCHEME</string>
          </array>
        </dict>
    </array>
</config-file>

在facebook-plugin的插件添加,为其他插件提供URL_SCHEME。

On "plugin add" of facebook-plugin, provide the URL_SCHEME for the other plugin.

这样,当正在安装facebook plugin时,它将为这两个插件添加两个URL方案。我知道这真的很奇怪的方式来解决这个问题,但我们需要这个功能尽快,不能等待Cordova添加此功能。

This way, it will add both URL schemes for both plugins when facebook plugin is being installed. I know it's really really hackish way to solve this issue, but we need to this feature ASAP and can't afford to wait for Cordova to add this feature.

请让我知道你们有另一种方法。

Please let me know if you guys have another approach.

这篇关于修改“* - Info.plist”的两个cordova插件CFBundleURLTypes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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