Xcode project naming error

I currently have an issue where when I open up my Xcode workspace, there is an error with the project name. It's clear that when it says Flash Chat.xcodeproj it should say Flash Chat.xcworkspace because I had installed pods.



[Xcode project image][1]



[Xcode project image after name change][2]


[1]: https://i.stack.imgur.com/11c2x.png


[2]: https://i.stack.imgur.com/5yYmU.png


However now when I try and change the name to Flash chat.xcworkspace, the name changes but I cannot open any of the files inside.


Prior to this, everything had been working, the error just appeared when I did two things : First I accidentally opened up the .xcodeproj instead of the workspace. I immediately closed it. Then I attempted to change the name of the workspace to Flash-Chat.xcworkspace. The problem then arose when I tried to open up the work space file.


Replies

>when I try and change the name


By what process, exactly?

Can you put everything back to the way it was by re-cloning one or more repositories, or restoring from a backup?


It should be perfectly safe to directly open a project that you normally open via workspace. It will of course just open that project (and not other projects that the workspace contains), but it's separate from the workspace, including having its own derived data folder.


When you open a project directly like this, Xcode creates a private workspace which it puts inside the project. That is to say, there's always a workspace, but Xcode hides the fact by inverting the relationship between the project and the workspace, if the workspace isn't explicit.


So, if you'd closed the project, then opened the workspace, you should have seen nothing strange, except possibly that the project package might have included some extra files to commit (the nested workspace that you don't care about).


What happened, exactly, depends on what you did. If you somehow renamed the nested workspace the same as the enclosing workspace, things might get weird, and if you renamed the project (.xcodeproj folder) to a workspace (.xcworkspace), things would have got a lot more weird.


It's not obvious how (or if) you can recover from this. Xcode tends to lie to you about the details of what's hidden away inside the project package. That might prevent it from changing things back to the way they were. That's why re-cloning or restoring is by far the easiest fix. If you've edited any source files, just move them aside, then put them back when your workspace is OK again.