mattstuehler
mattstuehler

Reputation: 9282

Can I change a Cordova/iOS app's "displayed name" without changing the entire file structure/Xcode project?

So, I working on my first Cordova app, and I've got a probably typical noob question...

I created my app with this command:

cordova create MyFirstApp com.[my_domain].myfirstapp MyFirstApp

I can see that this creates a complex file structure under a directory named MyFirstApp, an Xcode project named MyFirstApp.xcodeproj, and dozens of files beginning with MyFirstApp (e.g., MyFirstApp-Info.plist, MyFirstApp-Prefix.pch, etc).

All of that is fine.

But, after finishing development - I realize that I'd like the app's name as it appears on the user's homescreen to be something different (E.g., "Cool App!").

Can I change just the "displayed name" without making a mess of the directory structure and Xcode project?

It looks like the name node in config.xml doesn't do this - that value seems to control much more than just the way the name is displayed. (E.g., if I change it, cordova build iOS fails and Xcode starts complaining...)

Upvotes: 13

Views: 11273

Answers (5)

李文豪
李文豪

Reputation: 21

This code is work for me: (config.xml)

<platform name="ios">
    ...
    <config-file parent="CFBundleDisplayName" platform="ios" target="*-Info.plist">
        <string>Your Name</string>
    </config-file>
</platform>

Upvotes: 1

Simon L. Brazell
Simon L. Brazell

Reputation: 1272

You can add a short name to the name element in the config.xml of your app:

<widget ...>
   <name short="HiCdv">HelloCordova</name>
</widget>

Reference


Or if the above doesn't work, you can try this instead:

<platform name="ios">    
    <edit-config file="*-Info.plist" mode="merge" target="CFBundleDisplayName">
            <string>Your Display Name</string>
    </edit-config>
    ...
</platform>

Place that code in the config.xml file for the name to persist between builds meaning you don't need to manually edit every time.

Upvotes: 18

Sean Lynch
Sean Lynch

Reputation: 6487

You can change CFBundleDisplayName in your *-Info.plist file by adding the following to Cordova's config.xml

<config-file parent="CFBundleDisplayName" platform="ios" target="*-Info.plist">
    <string>My App</string>
</config-file>

Upvotes: 27

Benjamin Conant
Benjamin Conant

Reputation: 1734

From the top level of your cordova project navigate to platforms/ios/[appname]/[appname]-Info.plist

inside of the <dict> tag there should be an entry like so

<key>CFBundleDisplayName</key>
<string>[The current name]</string>

change this to

<key>CFBundleDisplayName</key>
<string>[The name you want]</string>

DO NOT include the [ ] ... they are just for demonstration

rebuild your project

Upvotes: 2

Marcus Adams
Marcus Adams

Reputation: 53830

Edit Bundle display name node in MyFirstApp-Info.plist.

Upvotes: 5

Related Questions