通过phonegap应用中的config.xml编辑info.plist文件?

时间:2018-08-31 13:34:01

标签: ios cordova phonegap-build phonegap

我正在使用此Facebook插件:

https://github.com/jeduan/cordova-plugin-facebook4

需要将以下代码添加到info.plist文件中以供iOS使用。

<key>CFBundleURLTypes</key>
<array>
  <dict>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>fb45656565656561</string>
  </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>45656565656561</string>
<key>FacebookDisplayName</key>
<string>APP-NAME</string>

还有

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>

我正在使用Phonegap构建,因此我只能使用info.plist文件来编辑config.xml文件...

我确实在phonegap应用程序项目中通过config.xml搜索了如何编辑info.plist文件,并发现了一些,但都是关于相机插件的。

有人可以请教这个问题吗?

先谢谢了。

1 个答案:

答案 0 :(得分:1)

最后我找到了:

 <platform name="ios">
 <config-file target="*-Info.plist" parent="CFBundleURLTypes">
    <array>
        <dict>
          <key>CFBundleURLSchemes</key>
          <array>
            <string>45656565656561</string>
            <string>APP-NAME</string>
          </array>
        </dict>
    </array>
</config-file>
</platform>

将此添加到您的config.xml文件中。

我希望这会在将来对其他人有所帮助,因为这似乎是此特定cordova插件在此主题上唯一的问题/答案。