Xcode scheme change display name - ios

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

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)"

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.

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.

Related

Where do all the Project Name and Target Names appear to a user in an Xcode extension?

I want to create a new Xcode Source Editor Extension. This involves creating:
A new Xcode project.
A new Xcode Source Editor Extension target.
Both require names obviously. I'm wondering where these names appear to help me decide how much context I should add to these names. For example, if it appears under a menu item of "Acme Corp", then calling it "Xcode Extensions" is sufficient. If it doesn't appear under such name, then including Acme in the title would make sense.
Furthermore, I tried changing the CFBundleDisplayName of the Target, and noticed that it doesn't update the Editor menu item name for some reason.
Where are all the places users will see these names and which settings control them?
First, I'll define the following:
AppTarget: The Application's target, which was created when the new macOS application was created.
ExtensionTarget: The extension's target, which was created after adding the "Xcode Source Editor" target.
And, I'll assume you named the Application "MyApp" and the Extension "MyExtension".
This sets up a project with the following options:
AppTarget > info.plist:
CFBundleName = $(PRODUCT_NAME)
AppTarget > Build Settings:
Product Name = $(TARGET_NAME) (i.e. MyApp)
ExtensionTarget/info.plist:
CFBundleName = $(PRODUCT_NAME) (i.e. MyExtension)
CFBundleDisplayName = MyExtension
Here are all the places a user might see these names:
Application:
AppTarget/BuildSettings/ProductName
This is the container .app the user installs/runs to get the extension.
System Preferences > Extensions:
AppTarget/BuildSettings/ProductName, in "Added Extensions".
AppTarget/BuildSettings/ProductName, underneath "Xcode Source Editor".
ExtensionTarget/info.plist/CFBundleDisplayName, in "Xcode Source Editor".
Xcode > Editor menu:
ExtensionTarget/info.plist/CFBundleName.
Some key things to note:
CFBundleName and CFBundleDisplayName for the ExtensionTarget appear in two different places, so they should probably be the same.
From the user's perspective, they just care about the extension. However, due to how extensions must be shipped with a .app, we must expose both an app and an extension to the user. They will therefore see both of those names in various places. You might want to keep these name consistent as well.
Attempting to modify AppTarget/info.plist/CFBundleName directly appears to have no effect in what the user sees. You must use the Product Name setting instead.

How to change app display name in Xcode 8 to add a space

I am trying to put a space in my app name (standalone sticker pack) in Xcode 8. The solutions I've seen on here are to change the Product Name (in packaging) or to change the "Bundle Display Name".
I've changed the product name and that hasn't worked (I cleaned, rebuilt, reset content and settings in simulator and logged out of xcode, logged back in and rebuilt app).
I can't see "Bundle Display Name" anywhere. Should I add it and if so, how do I do that?
I've read the thread How to change the name of an iOS app? and done the suggestions, but it's still showing in simulator and testflight without the space. Have I missed something?
Steps:
1. Open project Info.
2. Add a property Bundle display name into Custom iOS Target Properties. (as "Key")
3. Enter the display name, that will be shown on iPhone/iPad screen under an app icon. (as "Value")
It's my solution that works properly. Also you should delete previously installed app and reinstall it.
Just go to Target -> General -> In Identity -> Display Name. By default, it has your app display name which is unhighlighted. Enter here your new app display name.
There are two ways to change app display name.
Solution 1:
Goto Targets -> General Tab -> Identity section
In this you’ll find Display Name field where you set app display name.
Solution 2:
Bundle Display Name property is not present by default in Info.plist. You need to explicitly add this property.
Below image shows how to add this property.
Note: If still this new name is not reflected in your app then delete app and install it again.
When creating a new project, Xcode uses the Product Name by default. You can just change that in your Build Settings, even setting separate names for your schemes.
After changed Bundle display name make a Clean of project.
Change the Bundle Display Name (CFBundleDisplayName) in your Info.plist file
Check if you have any localization (InfoPlist.strings) files, and change the corresponding CFBundleDisplayName values in those files to the localized values.
That's it.
Goto Info.plist and add "Bundle display name" and set your rename in value box make sure the Bundle display name type is a string run the project automatically it will be changed
For xcode 9.3, Goto Targets, Build Settings, under packaging change Produce Name. See below screen shot
After this if it not changed, clean product to reopen X code.

iOS PRODUCT_NAME not the display and wrapper name

For my iOS app I am trying to have multiple build configurations so I can create development and production builds that target different servers, configurations etc.
In Xcode I have created another build configuration and scheme to target this configuration. So I have the separate configuration/schemes as:
Dev version
PRODUCT_NAME=MyApp-dev
BUNDLE_IDENTIFIER=com.organisation.myapp-dev
Original Version
PRODUCT_NAME=MyApp
BUNDLE_IDENTIFIER=com.organisation.myapp
Both configurations can be built with the different schemes. Both will run on the same device because of the different identifier, but the dev version still shows MyApp on the home screen. When looking in the build products, it produces a MyApp.app bundle with a target inside it of MyApp-dev.
Is there another setting to change the wrapper name from MyApp.app to MyApp-dev.app? And any other setting that may be preventing PRODUCT_NAME setting to be used in the app display name?
edit: In the info.plist file, both the CFBundleName and CFBundleDisplayName are set to $(PRODUCT_NAME)
n.b. I have done this before with another app and all is working fine there, hence the query if another developer has changed a more targeted setting that overrides this change.
There was a InfoPlist.strings file in the project that was overriding CFBundleDisplayName. I removed this definition from this file and all worked as desired.
The project is not localised and so I never considered this override! Hopefully if someone else comes across this, remember settings in Info.plist can be overriden with localised strings in this file.

How to copy a Target in XCODE 5.1

I want to make copy of my existing app target with different name.
The changed name should reflect in simulator and info.plist
Select your project, now on the left panel select your target and click Duplicate.
To edit the name of the scheme just click on manage schemes under the scheme selection.
After adding a duplicate target to existing target .If you want to change the name ,Then select that target under manage scheme --->tap enter key on that it will coem to edit mode .And you can change the name.

Change product name macro in iOS XCode project

I built my iPhone code atop Apple's sample project. It names the app "LazyTable" when placed on the home screen on iPhone. I would like to change this name. If I go to info.plist and manually type in a new name into the Bundle display name key, it works. But I don't want to hardcode because the PRODUCT_NAME is used in many places.
Info.plist
So I go into Project > Edit Project Settings to change the macro. I close the window, clean, and rebuild. The app name is still stuck with "LazyTable"! How do I make this change to the macro take effect?
Project Info
The approach you are using is correct. However, remember that each target can have their own settings that will override the project settings. Make sure the target does not override PRODUCT_NAME.
To do this, select the project in the Xcode project browser, then select the target. Each target has it's own build settings. Change the PRODUCT_NAME just as you would when editing the project build settings.

Resources