cordova-ios
cordova-ios copied to clipboard
Keys in Info.plist not merged but overwritted
Bug Report
When using together plugins that use pods, keys in Info.plist are not merged but overwritten.
It happens for example for plugins cordova-plugin-facebook4
, cordova-plugin-googleplus
and ionic-plugin-deeplinks
. They all set CFBundleURLSchemes
key in Info.plist. There should be contribution from each plugin but actually there is only one. Keys are not merged but overwritten.
I realized that this happens when <pods use-frameworks="true">
in plugin.xml is set. When set to false, keys are merged as expected.
Problem
What is expected to happen?
Keys are merged like this:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1234567890</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>REVERSED_CLIENT_ID</string>
</array>
</dict>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>URL_SCHEME</string>
</array>
</dict>
</array>
What does actually happen?
There is only one key:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1234567890</string>
</array>
</dict>
</array>
Information
Command or Code
Create blank cordova project, add plugins and check the result:
$ cordova create test test test
$ cd myApp
$ cordova plugin add cordova-plugin-facebook4 --variable APP_ID=value --variable APP_NAME=value
$ cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=value
$ cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=value --variable DEEPLINK_HOST=value
$ cordova platform add ios
$ less platforms/ios/test/test-Info.plist
After investigation in order to isolate plugin related bug I created as small as possible project to reproduce the bug fast: https://github.com/inited/cordova-plist-merge-fail
Environment, Platform, Device
Version information
Mac OS workstation:
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G103
$ uname -a
Darwin boaz.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
$ cordova --version
9.0.0 ([email protected])
$ node --version
v10.13.0
$ npm --version
6.13.1
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above