3

When I open Xcode it automatically opens the last projects that were open when it quit.

I have one .xcodeproj that gets displayed in red in the Project navigator and there are no files visible for the project. I am not able to compile the project.

Closing the window without quitting Xcode and re-opening it solves the issue and the project appears fine and I am able to compile.

I've scanned through the project.pbxproj file and nothing jumps out at me as an issue and it's quite strange when it works after re-opening the project.

I should also note that this happens on any machine that I clone the repo to.

Has anyone seen this before and somehow solved it?

runmad
  • 14,846
  • 9
  • 99
  • 140
  • It seems _you’ve_ solved it. You have a great workaround. File a bug report with Apple and move on. – matt Apr 01 '18 at 21:04
  • 2
    @matt It's not solved. – runmad Apr 02 '18 at 20:43
  • Well, granted, there's clearly a bug in Xcode, and it's enough to drive one crazy. But as long as you close the window and reopen it, the project finds its files successfully. That's a solution, because now you can get work done. Good enough! So, as I say, complain to Apple about the bug. Until they fix it, there's nothing else you can do other than use your workaround (or turn off automatic reopening of projects at launch — that's what I do). – matt Apr 02 '18 at 21:02
  • I can't find a fix for this. Happens to me every time I open Xcode – novelistparty Aug 23 '18 at 20:41

2 Answers2

4

In my case the issue was caused by a faulty location value on the FileRef element in the project.xcodeproj/project.xcworkspace/contents.xcworkspacedata file.

Clear the value that your file contains and simply enter self:. For reference, here's how it looks in a project newly created with Xcode 12.5:

<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:">
   </FileRef>
</Workspace>
Arieleo
  • 381
  • 3
  • 14
0

I also get bothered by this problem for a long time(this comment is 2 years after your first post, for now, it's 2020-3-12).

A little different is, your project is red, mine is black but dim.

My workaround is hold alt/option and shift key, click icon of Xcode on dock, Xcode shows the welcome page, then double click the project.

cool8jay
  • 31
  • 1
  • 6