简体   繁体   中英

XCode 4.2: Renamed project file in project navigator, all project settings/config lost

I'm panicking a bit here...

In the project navigator, I clicked and renamed my .xcodeproj file (thinking it was the way to rename the project).

What has happened is that all the settings and files for the project have disappeared from the project navigator, and i'm left with a blank project!

Checking in Finder, it's removed my old .xcodeproj file, created a new one with the name I gave it - but on inspection, the file is empty! nothing inside.

I fear I may have lost all the settings in there. My last commit to Git was a while back, so if I get it back from the repository, I will have lost some changes I made.

Is there a way to retrieve/undo what I have done, and restore my project?

See below - Alerts.xcodeproj is the "new" project I don't want.. no files associated with it at all.

在此处输入图片说明

(btw, somehow a while back I got my project file under a "New Group" - and I can't get that sorted either - but that could be a separate question!)

If I use the version editor, on the left pane I can see all the settings from the previously named project file.. but can't seem to get at them. I was expecting to see these on the right hand pane, actually - so I'm also confused by this. Can I use the version editor to get my old project file back somehow?

在此处输入图片说明

Many thanks in advance!

UPDATE

OK so I renamed the project file in Finder back to my original project filename - which has resulted in my files etc being displayed in Xcode again.. phew! Well - almost!

I now have no schemes, as you can see below. Where are schemes stored? Do I need to rename a file to match the project file now?

在此处输入图片说明

2nd Update - fixed it!

It is not the nicest solution, but I have found a way to restore everything to it's original setting. I'm sure this is a convoluted way of doing it - so I will wait a while to see if anyone comes up with a better solution. If they don't, then I'll create and answer with the answer below:

In Finder, I renamed the project file back to what it was originally. This brought back files and settings when I launched XCode. However - no schemes!

I fixed this scheme problem by updating the project name within a couple of files. here is the procedure:

  1. Right click on your project.xcodeproj file and select "Show Package Contents"
  2. In the resulting folder, navigate down to the folder xcuserdata/(username).xcuserdatad/xschemes/
  3. In here open up the .xscheme files, and find the following lines which will reference the old, unwanted & incorrect, project name:

ReferencedContainer = "container:Alerts.xcodeproj"

(In my case, Alerts.xcodeproj was the incorrect project name) 4. Change all occurences to match the correct project name.

Volia! fixes the problem.

Cheers :)

OK this is not the nicest solution, but I have found a way to restore everything to it's original setting. I'm sure this is a convoluted way of doing it though!

In Finder, I renamed the project file back to what it was originally. This brought back files and settings when I launched XCode. However - no schemes!

I fixed this scheme problem by updating the project name within a couple of files. here is the procedure:

  1. Right click on your project.xcodeproj file and select "Show Package Contents"
  2. In the resulting folder, navigate down to the folder xcuserdata/(username).xcuserdatad/xschemes/
  3. In here open up the .xscheme files, and find the following lines which will reference the old, unwanted & incorrect, project name:

ReferencedContainer = "container:Alerts.xcodeproj"

(In my case, Alerts.xcodeproj was the incorrect project name) 4. Change all occurences to match the correct project name.

Volia! fixes the problem.

Cheers :)

Xcode does that if it thinks your project is open elsewhere. It only allows a project to be open at one time. Close all your Xcode windows, and relaunch Xcode. It should function like a normal project after that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM