2

Update: I reported this as a bug to Apple and they fixed it! All this seems to be working OK in xCode 4.5. Historians may read on.

I would dearly love to rename a build scheme for an iOS project in xCode 4.3. I've successfully renamed the project:

Renaming

and then I can rename the target and the product:

RenameTarget

and then I can rename the scheme:
Click here to rename scheme
and then
and then click here

and then I choose

File - Source Control - Commit...

and get

The working copy "TestWeb" failed to commit files. fatal: Could not switch to '/Users/me/Programming/TestWeb/TestWeb.xcodeproj': No such file or directory

and indeed xcode is trying to commit the file TestWeb.xcodeproj despite the fact that xcode itself has just renamed that file to TestWeb5.xcodeproj when I changed the project name. this seems to be some combination of the different name changes I'm doing here, changing just one thing produces no error, but more than one change confuses xcode - sometimes.

Do I have to do all this in some specific order? Or do I just have to give up and create a new xcode project with the right names and paste my files into that and lose the old record of commits in the old git archive?

I found this SO answer and looked in the xscheme files as suggested and can only find references to the new names.

Community
  • 1
  • 1
emrys57
  • 6,679
  • 3
  • 39
  • 49
  • 3
    Who let Winnie the Pooh get on SO? – SimplyPanda Jun 07 '12 at 13:54
  • 4
    Thank you, please don't steal my honey. – emrys57 Jun 07 '12 at 13:58
  • Modifying the Target or the Build Product isn't needed to cause this. Just modifying both the Scheme and Project names definitely can cause it. – emrys57 Jun 07 '12 at 16:20
  • And, by the way, changing the project name spuriously changes the Build Product name from ${TARGET_NAME}, which tracks changes in the target name, to a fixed string which happens to be the same as the current value of the target name, so it goes wrong if you later change the target name. But this doesn't seem to be related to the commit problem, since that fatal commit error still occurs if I forbid xcode to change the Target and Build Product names when I change the project name. – emrys57 Jun 07 '12 at 16:25
  • Next day, and I can't see any solution - after changing both Project and Scheme names in xcode, git becomes unusable, and I can't find a way back out other than to create a new project and paste my files into that. I filed bug 11623514 with Apple for this behaviour. – emrys57 Jun 08 '12 at 09:35

2 Answers2

2

I had this problem, and all I did was commit the changes using github. Then in xcode I selected File -> Source Control -> Refresh Status

1

I've been struggling for a while with this, but now I've found the solution! :)

It's not a great way to resolve it but Apple hasn't fixed this bug so...

  1. Install GitHub.app from github.com (http://mac.github.com/).
  2. Add the folder of your project (where .git can be found) to your list of repositories on your computer in the GitHub app.
  3. Commit uncommitted changes through this application
  4. In Xcode organizer, add a branch to the git repository for the app
  5. Make a random change to a file under version control and commit through Xcode
  6. Remove the branch you just created (through Xcode)
  7. It should now work (it did for me) to commit directly through Xcode

I'm not sure whether you need to do step 5. You might be able to branch and then remove that branch..

This worked for me, I hope it works for you too!

jr19
  • 92
  • 7
  • Well, thanks very much! That did work for me too, although it was a bit scary. I struggled to use the organiser with branches, but found help at http://useyourloaf.com/blog/2012/02/29/git-branch-management-with-xcode.html – emrys57 Jun 20 '12 at 10:52
  • What if you do not use GitHub? Is there another way to fix this problem? – Jacob Mar 02 '15 at 14:28
  • @Jacob you should be able to create a new repository in the directory where your project is stored. And work around it that way. I haven't had a problem since, and haven't tried any other solutions Also, I've since been using SourceTree for git and it's more advanced and easier to use – jr19 Jun 19 '15 at 11:32