cordova-plugin-app-name icon indicating copy to clipboard operation
cordova-plugin-app-name copied to clipboard

"cordova build ios" again overwrites CFBundleDisplayName in info.plist, removing the changes done when adding this plugin.

Open sachingarg05 opened this issue 5 years ago • 8 comments

Adding this plugin successfully changes values for both CFBundleDisplayName and CFBundleName in info.plist.

But running "cordova build ios" after adding this plugin again overwrites CFBundleDisplayName with the default name value from app's config.xml, ignoring the plugin.xml.

CFBundleName value does not change again, only CFBundleDisplayName value gets modified again. iOS only checks CFBundleDisplayName if it exists, so CFBundleName gets ignored by iOS.

sachingarg05 avatar Apr 10 '19 22:04 sachingarg05

Yes, exactly. Confusingly, still an issue and defeats the purpose of using this plugin. Android app names aren't the problem, iOS app names including spaces is -- at least for us.

consciousimages avatar Oct 22 '19 16:10 consciousimages

Same issue here... Have you found a solution?

Amaury-T avatar Jan 19 '20 14:01 Amaury-T

No, I finally came to the conclusion that it’s a Cordova bug - it has to be as the results with and without the plugin are always pretty much the same. Occasionally (and seemingly randomly) the name would be correct but I could never get anything I tried to work consistently. In the end I more or less gave up.

consciousimages avatar Jan 20 '20 03:01 consciousimages

Completely random thought: Does anyone know for sure if the Cordova CLI handles plugins synchronously or asynchronously during a build?

I'm just wondering if the order in which the plugins are listed might possibly affect this; such as perhaps some other plugin that also writes CFBundleDisplayName after this plugin has written it's value.


Although, having said that...

Occasionally (and seemingly randomly) the name would be correct but I could never get anything I tried to work consistently.

This makes me think it might be handling them asynchronously, which means this might be some race condition with another plugin that's also updating the same value.

@sachingarg05, maybe you could try reproduce this in your environment with a fresh project and only cordova-plugin-app-name installed? I suspect this might show something useful.

ZaLiTHkA avatar Jan 20 '20 07:01 ZaLiTHkA

Same here 😂

LyuGGang avatar Oct 11 '20 12:10 LyuGGang

Any solutions?

lovelyelfpop avatar Jan 08 '21 10:01 lovelyelfpop

In config.xml the name element has a "short" attribute where you can set the CFBundleDisplayName with unicode characters like this:

<widget ...> <name short="Hello&#x2007;Cordova">HelloCordova</name> </widget>

I found this solution in the documentation: https://cordova.apache.org/docs/en/9.x/config_ref/index.html#short-name

jurki avatar Feb 19 '21 20:02 jurki

Just wrote a hook to replace "CFBundleDisplayName" in plist. Anyone can merge this in plugin? https://github.com/sonicwong/cordova-hook-ios-CFBundleDisplayName/blob/main/iosCFBundleDisplayName.js

sonicwong avatar Nov 16 '22 07:11 sonicwong