Change product name macro in iOS XCode project - ios

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.

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.

Xcode scheme change display name

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.

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.

Xcode target icon not displayed

Whilst trying the AFNetworking iOS example project I noticed that Xcode was displaying the target icon. Xcode does not do the same for my own projects/targets however.
AFNetworking iOS example project that shows the target icon:
A project that does not show the target icon:
The only difference I can see between both projects is that the AFNetworking iOS example target has an 'Icon files (iOS 5)' ('CFBundleIcons' raw key) dictionary within *-Info.plist. Surely this cant be the source of the problem though given that my example project is targeting iOS 7? Both targets do have an 'Icon files' ('CFBundleIconFiles' raw key) array within *-Info.plist.
Please could someone help to shed light on where Xcode is looking for the target icon?
I tried all the above and did not fixed the icon issue. I was using assets catalog for the project and X-Code version was 5.0.2.
Following steps fixed my issue:
Select the Project file from the navigator and select the target which you do not have the icons
Then select Build Phases and expand and Copy Bundle Resources
Add the *.xcassets file to the bundle resources (In my project the file name was Images.xcassets)
Clean and build the target.
To get the icon to appear you have to have the App Icon (Icon-72.png) in the root directory of your project.
If you've changed the App Icon name, you must change the correct properties (CFBundleIconFile, CFBundleIconFiles, and CFBundleIcons) in the Info.plist to the changed App Icon file name.
(This part doesn't matter, but I've found it works much better if you do.)
Fully qualify your info plist file in your target build settings with the following variable name: $(SRCROOT)/your_plist_file_name.plist (of course changing "your_plist_file_name" to the correct name)
I've also found you have to change your target's info plist to a different plist, then back to the correct plist file in order for the icon to show in the build settings. You'll also have to click away from the project file and then back in order for it to show in the list of targets.
I'm using Xcode 5, but this should work on Xcode 4 and above.
Good Luck.
Please flow the step
1)Click on the app icon arrow
2) drag the app icon 120*120 px
3) fisrt time click on the scheme then show the app icon or rest the simulator and again run
See this screenshot:
Here Blue are dimensions and red are icon names. Like 57-57 is actually 57-57.png. Put all these icons in the root of the project with .xcodeproj file. Add them into the project. Then set them all accordingly in Target > Project Name > General
Doing this will start showing every icon at its place in XCode automatically.
If using the Asset Catalog, select Images.xcassets and look in File Inspector. Check the target membership and make sure your target is selected.

Resources