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



我正在使用这个Facebook插件:

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

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

<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 构建,所以我只能使用config.xml文件编辑info.plist文件......

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

有人可以就此问题提供建议吗?

提前谢谢。

最后我找到了:

<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 插件关于此主题的唯一问题/答案。

最新更新