Reputation: 516
I'm trying to grab a variable and use it in my plugin.xml to build URL Types. Every times I build, I check my .plist file. It spits out the $URL_SCHEME instead of the actual value. Here's my code,
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>MY_SCHEME</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$MY_SCHEME</string>
</array>
</dict>
</array>
</config-file>
I added my plugin using,
cordova plugin add ../myplugin/ --variable MY_SCHEME=myScheme
Any idea why "myScheme" doesn't show up on my .plist file, but instead it shows "$MY_SCHEME" ?
Edit July 27, 2015: Here is my plugin.xml - http://pastebin.com/YH7LzTjf
Upvotes: 0
Views: 69
Reputation: 6191
You need to add <preference/>
to make --variable
work. Try this:
<preference name='MY_SCHEME'/>
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>MY_SCHEME</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$MY_SCHEME</string>
</array>
</dict>
</array>
</config-file>
I don't know - for some reason I'm unable to add it with CFBundleURLTypes
as a parent (although it's fine for some other strings), but it might be something wrong with my Cordova.
Upvotes: 1