Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming targets in Xcode 4

Tags:

xcode4

In Xcode 4 I changed the name of my cocoa Application's Target Name because I wanted to change the name of the executable. The Build works fine but after compiling Xcode still starts the old executable that is still listed in the Products folder in the project navigator.

How can I change which application Xcode 4 starts up after build?

like image 651
TalkingCode Avatar asked Mar 19 '11 13:03

TalkingCode


People also ask

How do I rename a module in Xcode?

Select the project you want to rename in the “Project Navigator” which can be found on the left side of the Xcode view. On the right-hand side of the window, select the “File Inspector”. The name of your project should be in there under “Identity and Type”, change it to “NEW” and press Enter.

How do I rename a file in Xcode?

Click on the project you want to rename in the "Project navigator" in the left panel of the Xcode window. In the right panel, select the "File inspector", and the name of your project should be found under "Identity and Type". Change it to your new name.

How do I find the target name in Swift?

And now in Swift, you may call AppTargetName() and get your target name, without need to modify Info.


1 Answers

To change the name of the application, you can select the new target, click the Build Settings tab, look for the Packaging section and change the Product Name. You'll notice the entry in the Products group in the navigator changes.

Since Xcode automatically creates matching schemes for each target by default, you'll also need to make sure the scheme for your new target is set to build and launch the new target's matching executable. To do this, select the scheme from the popup then choose edit scheme from the same popup. Select the Run action in the scheme editor sheet and make sure the Executable popup is set to your new target's newly-renamed executable. Do the same for the Profile action so it does the right thing when using Instruments and all. It should be properly selected already, but sometimes Xcode gets confused when renaming/moving things around.

like image 100
Joshua Nozzi Avatar answered Sep 22 '22 23:09

Joshua Nozzi