问题
I have a custom Xcode build scheme that moves some files to toggle between dev and prod variables. Can I change the app display name in the dev scheme as well?
For example, if the app name is "MyApp", it currently shows up on the home screen as "MyApp". Can I configure my dev build scheme so that it shows up on the home screen as "MyApp Dev"? I tried setting TARGET_NAME="MyApp Dev"
in a pre-action build script, but it doesn't seem to work.
Xcode 7, iOS 9
回答1:
You can do that easily.
- Add a "User-Defined Setting" (e.g. DISPLAY_NAME) to your target and set different values for different Schemes.
- Go to the "Info.plist" of your target and add "Bundle display name" key and set its value to "$(DISPLAY_NAME)"
回答2:
In Xcode 8 (at least), in your build settings you should already have a setting called "Product Name" (under "Packaging"). That will take different values for different schemes, although they all default to "$(TARGET_NAME)". That's why, if you don't specify the display name, it takes the target name.
You can change any or all of them.
This way, you don't have to create a new user-defined setting.
回答3:
This works for Xcode 9.
Target (General tab)-> Display name - $(PRODUCT_NAME)
In Build settings tab, search for Product Name and give the required product name under each schemes.
来源:https://stackoverflow.com/questions/33201489/xcode-scheme-change-display-name