修改"*-Info.plist"CFBundleURLTypes的两个cordova插件

Miq*_*uel 4 ios cordova cordova-plugins

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

<config-file target="*-Info.plist" parent="CFBundleURLTypes">
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>$URL_SCHEME</string>
      </array>
    </dict>
  </array>
</config-file>
Run Code Online (Sandbox Code Playgroud)

第二个:

<config-file target="*-Info.plist" parent="CFBundleURLTypes">
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fb$APP_ID</string>
      </array>
     </dict>
  </array>
</config-file>
Run Code Online (Sandbox Code Playgroud)

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

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

sev*_*sea 7

在Cordova 3.6.3-0.2.13上,两个配置值都是以这种方式添加的:

<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>
Run Code Online (Sandbox Code Playgroud)

在Cordova 4.0及更高版本(4.0.0,4.1.2,4.2.0)上,第二个添加的插件的配置值将被忽略.因此,plist看起来像(假设facebook插件首先添加):

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb12345678</string>
        </array>
    </dict>
</array>
Run Code Online (Sandbox Code Playgroud)

作为一种解决方法,我们修改了facebook插件以添加两个URL方案,一个来自APP_ID(fb $ APP_ID),另一个用于URL SCHEME插件.我们检出了facebook插件源以便能够修改源代码,并从该目录添加了插件而不是从GIT获取.

在phonegap-facebook-plugin的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>
Run Code Online (Sandbox Code Playgroud)

在facebook-plugin的"插件添加"中,为另一个插件提供URL_SCHEME.

这样,当安装facebook插件时,它将为这两个插件添加两个URL方案.我知道解决这个问题确实非常糟糕,但我们需要尽快使用这个功能,并且无法等待Cordova添加此功能.

如果你们有其他方法,请告诉我.