-->

Xcode - How to change the display name of an app f

2020-06-11 14:20发布

问题:

The product name of the app is the name of your app as it will appear to customers and you choose it in the Xcode Assistant when starting a new project, but what if you would like to change it?

It seems a trivial question but I tried searching and I find old answers like this one Changing Cocoa display name in the app? (seven years ago) or this one How to change the name of a Mac application in the build settings? which assumes you have a MainMenu.xib file, or answers that refer to iPhone as for example this answer (nine years ago) How to change the name of an iOS app? or this Apple's Technical note for iOS.

Because many things may have changed in Xcode since seven or more years and macOS is different from iOS, I'm afraid to create some trouble, or to change the name that appears in some parts, but forget the old name in another place.

What is the correct way to change the name that the user sees in an app for Mac?

回答1:

There are several ways to change the name of the app, after you have created the project:

  1. You can rename the target (Double click on the name) because by default Xcode uses the target name as product's name (see next screenshot).

  2. You can set the product name directly in the build settings or via xcconfig files. I actually prefer this way because you can create different names for different build configurations, e.g., "MyApp Debug", "MyApp Beta", "MyApp". So just replace the $(TARGET_NAME) with the name of your app.