Changed my app's name, now every file is red on xcode - ios

every single of of my files are red and I cannot access them... I just changed my bundle, name and other info to a different name (app used to be called apple, now it's called orange with the bundle changed as well). Anybody know how to fix this?

Sounds like you changed the name of a directory that contains your files--and now Xcode can't find any of the paths. Change that directory back to the old name. It doesn't matter as long as what's in your project settings and Info.plist contain the new name.

A: To change the name appearing underneath your app icon, modify the CFBundleDisplayName key in your Info.plist. Follow these steps to modify CFBundleDisplayName:
In Xcode, select your target under "Targets" in the project navigator.
Select the Info pane.
Click the disclosure button next to Custom iOS Target Properties to reveal a property list editor of keys and values.
By default, Xcode displays a human-readable string of a key rather than its actual name. So, search the property list for "Bundle display name". click over there and write the name that you want to display.
source:
https://developer.apple.com/library/ios/qa/qa1823/_index.html
to access everything.,go back and change the names to previous one as #nicholas said

Related

Xcode: How to use multiple "Display Name" values, different per each configuration?

In Xcode we use multiple configurations to compile several different apps, with different Bundle IDs and Display Names.
While the "Identity -> Bundle Identifier" correctly shows a greyed-out "" read-only value, this is not the same with the "Identity->Display Name", resulting to a common name for all configurations.
Note that we have added different values on the "Build Settings -> Product Name" property for each configuration, since our Info.plist entry for CFBundleDisplayName is $(PRODUCT_NAME).
We tried to have a blank "Identity->Display Name" and initially this worked (the Name was eventually the one provided by the configuration's "Build Settings -> Product Name").
However, at some point (when switching Schemes we think) the "Identity->Display Name" took again a generic name (the one used for the .app filename) and this caused all the different "Build Settings -> Product Name" values to be replaced by this same generic name.
Is this a bug? What should we do to NOT have the "Identity->Display Name" editable and rather get its value from the configuration values (like the Bundle ID does)?
Note: We also tried all suggestions provided here: Xcode scheme change display name
They did not work, see some comments below the answers there.
Update for Xcode 14 and up: you can click the + icon behind the text input of Display Name (under Identity in the General tab) and set a value for each build configuration.
For older versions of Xcode:
After you have created different build configurations, you can use a user defined setting per build configuration that sets the display name.
In order to do this you need to click on the Build Settings tab, and in the build settings tab you need to click on the + icon in the left upper corner and then select Add User-Defined Setting. A new entry in the user defined settings (at the bottom of the Build Settings tab) will be created with the name NEW_SETTING. Rename this to whatever you want, e.g. APP_DISPLAY_NAME. If you expand this setting (by clicking on the chevron icon to the left of it) you can set a value for each build configuration.
Now go back to the General tab and for the Display Name, fill in your user defined setting like so: ${APP_DISPLAY_NAME} (replace APP_DISPLAY_NAME with whatever you named your setting) and press enter. Each build config will use the value from the user defined setting as the display name now.
When using a user defined setting as the display name, it is not shown as <Multiple values>, however it does take its value from the user defined setting. You can see it changing by switching the scheme, cleaning and then switching from the General tab, and then switching back to the General tab.

Can i change my project name in Xcode while Apple reject me coz my app's name is not available

I have done all things with my old name , but Apple ask me to change it , but can I change it? I am afraid that everything will messed up after I change my name , coz all related to this project name , so what can I do , actually I do not know if I can change , I am just afraid , Can anyone tell me if I can change my app name in Xcode and if there will be something messed up ?
You can change the name of the app without affecting the name of the project or the code.
I am making the assumption you just want the app display name different, so here is how to do it:
Go to your Project Settings and Select Target
Next you can move across and select Info
Right click anywhere in the table and select add row. It will come up with some options - type "Bundle" and it will display the option Bundle display name. You need to select that.
On that line,click the right of the row and add your new name.
This will not affect your code and will only change the display name of the app. Now you have a new display name without effecting the main bundle.
If you don't change the name Apple won't publish it on the App Store. I think it's an easy choice.
You don't need to change your project name. You don't need to change the bundle name. Just the external name of the app. It's a really small change.
From the Navigator click the XCode project
Click "Build settings"
Click the search field and type product_name
Change the Product name to a new one
Repeat for every target you have.

Changing project identity and type in Xcode

I have a working iOS application in Xcode, and wanted to change the display name of the application on the phone. When i click on the main project directory in Xcode, a menu opens on the right side of the screen. Under the title "Identity and Type", I tried to change the name to something different. When prompted, I chose to change the references in other files. Now, my file has an error, because my -info.plist file no longer exists (because the project is apparently trying to reference the plist file sharing the original name of my application). When I tried to simply change the name back to the previous one, I get an error that says
"OldProjectName.xcodeproj" couldn't be moved to "ios" because an item with the
same name already exists. To save the file, either provide a different name,
or move aside or delete the existing file, and try again.
I realize this problem is likely trivial, but i'm not entirely familiar with Xcode and i'm concerned that I will delete or move an essential file. For some reason, although I enabled them, I don't have any screenshots I can revert back to. Any suggestions on how to fix this?
To fix the error, change the name of the project (which is what you changed) back to what it was originally. To answer your question, to change the display name go to the info.plist and change the "bundle display name" to whatever you like.

Configuration dependent value in Info.plist file

I have three configurations in my iOS project:
Debug
Adhoc
Release
Now I want to change the name of the App as follows:
MyAppDebug
MyAppAdhoc
MyApp (Note that this one does not have a suffix)
Is there a way I can easily achieve this in Xcode with some type of "compiler-if-else-macro-thing"?
Changing display name of app for respective configurations:
one way to achieve this is by using the same info plist file that you have.
Part 1: create a user defined variable
Click on target project file.
Then at bottom right corner locate button "+" Add Build Setting.
Click that button "Add Build Setting" and select "Add User-Defined
Setting" enter name for New Setting as for ex: "BUNDLE_DISPLAY_NAME".
Expand this new setting to see the configurations under it. Give the desired name to be displayed for each configuration.
For ex: Debug -> MyAppDebug
Part 2: use it
Select your appname-info.plist file.
Locate key "Bundle Display Name" and value to it should be this new user defined variable ${BUNDLE_DISPLAY_NAME}
Then for appropriate configuration it will select name from BUNDLE_DISPLAY_NAME variable in build settings.
Also you can have two different info plist for different configurations which is different files and then from Build Settings > Info.plist File section you can change it.
Sure. First you have to create separate Info.plist file each configuration. Then in you Project's build settings find the line where Info.plist is placed, expand that line and choose separate Info.plist file for each configuration you have. Then you can enter desired name in corresponding field in each Info.plist file. That's it :)

How can I change the name of an iOS app in Xcode?

I began an iPhone project the other day with a silly development code name, and now I want to change the name of the project since it's nearly finished. How can I do this?
Go to Targets in Xcode.
Build Settings on your project's target (your current development name).
Search for Product Name under Packaging. Change its value to what you want your new project name to be.
In new versions of Xcode (Xcode 5 too), to change the name of the project, follow these simple (detailed as possible) steps:
Note: In this example I'll change a hypothetical "Sample" name to a "Test" one.
Click twice slowly on the project root in the project navigator and then it becomes editable.
Rename the project.
After pressing Enter the assistant will suggest you to automatically change all project-name-related entries and will allow you to de-select some of them, if you want.
Press 'RENAME' and Xcode will do the rest. In the meanwhile Xcode may ask you about the option of making a snapshot of the project (it is very recommendable to do so).
In addition to renaming the project, you may want to rename the scheme so that it matches your new project name.
Repeat similar steps like 1 and 2, and press OK.
That's it.
Another scenario...
The previous explanation was related to changing the project name, but chances are that you only need to change the display name that appears below the app icon in the home screen. These are the steps:
In the "Supporting Files" group locate the info.plist (or related) file
Locate the "Bundle display name" key and change the value to the new name.
Delete the "old" app from the simulator or any other testing device.
Clean and rebuild your app again.
That's it. You will now see the new app name in your home screen.
You change the bundle display name in the info.plist file. It's as simple as that.
Changing the 'bundle display name' (as opposed to 'bundle name') is the only way to include characters like '+' in your applications name. Including special characters in the project name will cause an error when uploading to App Store!
In Xcode 4 search for "Product Name" under "Build Settings" tab of the target.
Select Target
Select Info
Insert Bundle Display Name and set App Title
If you want to change the display name only then you can directly change it in the property file (plist) of the app.
You can add a new row with the following key: Bundle display name
Here is an example for this:
When you use this the app name, which you have given with this key, it will be displayed.
So you can do this simply.
This is how I changed it in Xcode 4:
Click on your target file (the first main file of the application).
Go to Build Settings.
Scroll down you will find a bar called "Packaging".
Under Packaging you will see Product Name, and you can change the project name.
In Xcode 3.2, just select the Project entry in the Groups & Files panel, and select the menu item Project → Rename… It worked for me.
Xcode 7/8? It's in the plist that your target uses
For Xcode 10.2:
Although this question has many answers but I wanted to explain the whole concept in detail so that everyone can apply this knowledge to further or previous versions of Xcode too.
Every Xcode project consists of one or more targets. According to apple, A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. So every target is a product (app) on its own.
Steps to change the name:
Step 1: Go to the Targets and open the Info tab of the target whose name you want to change.
Step 2: View the Bundle name key under the Custom iOS Target Properties that is set to the default property of $(PRODUCT_NAME).
Step 3: You can either change the Bundle name directly (not recommended) or if you open the Build Settings tab then on searching for Product Name under Setting you will see that Product Name is set to $(TARGET_NAME).
Step 3A: You can change the Product Name or you can also change the Target Name by double clicking on the target.
So changing the Product Name (App Name) or Target Name both will result into similar results. But if you only want to change the App Name and want to keep using the same Target Name then only change the Product Name.
From Xcode 4.2 and onwards, you can use one more option.
Just click once on the .proj file name at the top in left navigation pane and it will be available for renaming. Rename it and the whole project will get renamed and not only the target.
For Xcode 11, if you want to change the App Display Name then simply go to plist and simply replace the value of CFBundleDisplayName:
<key>CFBundleDisplayName</key>
<string>Your App Name</string>
The best way I like in Xcode 5 is to change product name in building settings. Search "product name" in "building settings", and change it.
If you need to change the name of the application as it appears on the iPhone's home screen, you need to do it in the Target configuration, not the project configuration.
Expand the Targets group in Xcode, and then single-click the item under that. It should share the name of your project, which is also the default name of the application that gets generated.
Press Command + I to bring up the Info window, and then navigate to the Build tag.
Set the Configuration drop-down to read All Configurations.
Look for a setting called Product Name under the Packaging heading.
Change that value to the name you want for your compiled applications and, in the immortal words of Bugs Bunny: Voilà! Do a clean and a build. Your application will take on the new name.
If you want to change the name, that will be displayed on your screen, right under your icon, in Xcode 4, go to Targets → Info → Bundle Display Name and change it to whatever you want.
In Xcode 4 click on project name to start renaming.
It's very easy to change in Xcode 8. enter the app name in the "Display Name" field in Project Target → General Identity section.
Also: your target name may be the same as your app name - note that changing the target name does not change the app name - only the change in the target properties described below - will change the app name.
A note on the bundle display name -- this is the right way to change the name in your app menu, but you'll likely have to reset content and settings in your iOS simulator before you see the change actually take effect.
You can modify the Product Name without changing your Project Name (especially the directory).
Build Settings > search the keyword "product name" > update values
For the sake of gathering all relevant information in one place, here is the official answer to this question - and it is the only one that worked for me on Xcode 5.1.1
Just use the Identity and Type pane in Xcode.
Select the top-most line to the left (with your project name, number of targets, etc.).
Select the target you wish to rename.
Click on the name of the target again.
Type the new name.
Press Enter.
For changing the application name only (that will display along with the app icon) in Xcode 4 or later:
Click on your project file icon from Groups & Files panel, choose Target → Build Settings → Packaging → Product Name. Click on the row. A pop-up will come. Type your new app name here.
For changing the project name only (that will display along with project icon) in Xcode 4 or later:
Click on your project file icon from the Groups & Files panel, choose Project (above targets) from the right pane. Just see at the far right pane (it will be visible only if you have enabled "Hide or show utilities"). Look for the project name. Edit it to a new name you want to give your project.
Delete your app from simulator/device, clean and run. Changes should reflect.
That's it.
I saw many ways to change your app name on the home screen, and I don't think the necessity of edit your .plist file or changing Build Settings of target is justified.
By default in Xcode 7.2 you even don't have 'bundle display name' in your plist file.
And by default, your 'Product name' in 'Build settings' tab of your target is equal to $(TARGET_NAME). IMHO, it's convenient and didn't mean to change.
So you can simply change your Target name like hallski said in his comment for accepted answer. I made picture for it:
I think there is a bit of confusion:
Do you want to change the project name or
do you want to change the App name on the iOS dashboard?
Usually it is enough to change the latter, adding/modifying the BUNDLE DISPLAY NAME key in plist.
It is better to leave the project name untouched, but it may be changed.
Note that Bundle display Name can contain spaces and special characters, but project not. Doing so some cmd line tools will fail due to filename path rules.
And even more Bundle Display names can be localized.
So unless you are in early stage and need to change the internal project name, go on using the Bundle Display Name key.
Project Navigator → General → Display Name
There are
Product name ($(PRODUCT_NAME)): defaults to Target name. This is useful for scheme to select the right target
Bundle display name (CFBundleDisplayName): defaults to Product name. This is what is displayed to your iOS user
Follow these four steps maintaining serial no. And in step 4 give your desired name..
The easiest way: select the TARGET name, double click on it, and rename.
You'll see your app's new name underneath the icon on your device or simulator.
Using Javier's approach to rename my app works perfectly. There is just one small bit missing in the end that I wanted to add.
I still ended up getting a Mach-O Linker Error after a clean and rebuild. To resolve this; select yourProject (in the Project Navigator). Under Targets, select yourProjectTests (the test target) → under the General tab, update the Host Application's value to the newly renamed project.

Resources