Xcode - renaming project causes problem

2019-03-15 14:04发布

问题:

I'm currently working on an iphone application. I started working on this from a project template that I found on the internet. Now I want to rename this project. I've successfully renamed the actual project file, folder and the executables and some other stuff, but there is one weird problem. If I try running the application on my iphone device, Xcode refuses to run the executable with the new name - it's trying to run the old one with the old name instead, and thus it happens that it says: "No launchable executable present at path." Which is true, since the path is wrong (wrong name). The weird thing is that it works on the iphone simulator - it's using the correct executable path.

Any help would be appreciated.

回答1:

In 3.2.1 on Snow Leopard, there is a "Project->Rename..." menu item that works like a charm. I think it was introduced in 3.2. Shame that it's Snow Leopard only.



回答2:

Renaming Xcode projects can be an absolute nightmare. I personally feel that the best way to "Rename" a project is to create a new Xcode project and copy in the necessary files. I know this seems inconvenient, but it's the most straight-forward approach that I know of.

Currently, renaming a project involves doing a couple of find/replaces on the project, and changing things in the project settings.

I would love if Xcode automated this for you. This is one thing where Eclipse really shines as an IDE.

Good luck!



回答3:

http://aplus.rs/cocoa/how-to-rename-project-in-xcode-3x/

I found that to work quite well. Basically, if it's only the executable name you want to change, then open the main project file (the .xcodeproj) as a folder (right click > show package contents), and open the files in there. Then search them for (regular expression this) product.*name, and for each item you find, replace that which is on the right side of the equal sign to what you want your executable file to be named.

I used the text editor smultron for that. Awsome program...



回答4:

I just want to add to the above answers that Apple have made this relatively easy in XCode 3.2 - just rename the whole project in Project->Rename and also change the product name in the project settings...

...but after doing that, I still got the 'No launchable executable...' message.

The key is to restart XCode after this point (it seems actually necessary to do this), and everything should be okay.

Just hoping this saves someone a few minutes of confusion!



回答5:

What I would suggest you do is just rename the Product. Right click Project then Build -> Packaging -> Product Name. Updating this Product Name should be enough.



回答6:

Go for this link.

http://www.thohensee.com/?page_id=180

This link not only provides the way of renaming the project. It also provides the details of changing executable name. Try it. I have implemented it in my project.

Point to be Noted :

Suppose old Name is "Sagar_RK"

& New Name is "SagarRK"

Project will be renamed, but you need to remember following thing.

When you use shared application delegate. You must have to take delegate with old name application delegate.

For example

Sagar_RKAppDel *t=(Sagar_RKAppDel*)[[UIApplication sharedApplication] delegate];

Try it out.

Best of luck.



回答7:

One thing I had to do, after I thought everything was renamed everywhere was go to:
Project - > Edit Active Target

Then edit the "Product Name" field under Packaging (on the build tab).



回答8:

Rename project in XCode 4

https://devforums.apple.com/message/378575#378575

Open the Project Navigator Click on the project name at the top of the tree, tap again and rename box should appear Review changes - note it will try and change all text everywhere so unselect them as needed.



回答9:

This tutorial from phonegap on renaming projects seems pretty good. It seems to point out all the areas that need a change. I don't think it matters whether or not you're renaming a phonegap project or a normal project.

phonegap tutorial



回答10:

This is what I found helped me: http://drjunker.org/2008/04/10/xcode-rename-project-and-application-change-copyright-and-version-number/. Notice the comment by John Beatty (jcb) - it's an important addition to the steps described in the post.
And this is an in-depth post explaining the various kinds of clones you'd want to make, and how to do them. Very informative.



回答11:

Here is your Project name in XCode4. Simply change the name and press Enter. It works exactly like old XCode version (Project->Rename)...

!! Enjoy !! :)



回答12:

None of these suggestions made my project work after I renamed it using Muzammil's suggestion (the so-called correct way of doing it). It's a shame that Apple cannot rename a project that their own tools created. Why not remove all ways of renaming of a project if not even Apple can do it?... shame on Apple!

I renamed my project which had versioned xcdatamodels and trashed a lot of work... I'm still trying to make it build!



回答13:

In Xcode 6.3. I think you just need to make "New Scheme" in a place where you can select the device. Then save it and the project should be run on the device as well as on the simulator.

The following screenshots



回答14:

Not to be negative but the one thing about XCode that sucks is all the bugs. I'm hoping XCode 4. Is a total rewrite and thus more stable. At best some of the XCode releases have amounted to betas.

In any event you have good responses to your question. Venting.

Dave