33

I have a couple of projects that I had started under Xcode 3.2.x some time ago. I switched to Xcode 4 a few days ago and want to make use of the Workspace feature as both projects. Basically, my plan is to extract some common features out of the two projects and make them a common library that both projects depend on. However, before I even get to the tricky bit of dependencies I get stuck just adding my two projects to the workspace.

I tried creating a new workspace and selecting "Adding files to " from the context menu; I then select the .xcodeproj file from my first project and it appears in the left-hand side tree browser in my workspace. However, it's just the file, not the project that I get. That is, rather than getting a two-line entry in the tree browser where the first line states the project name and the second line says something like "1 target, iOS SDK 4.3" like in the Apple documentation, I get a single line simply stating the name of the .xcodeproj file including the extension. There is also no triangle on the left to expand the node. It's like I just dragged some file in the workspace, not a project. The same goes for the second project.

I have also created a new Project "Foo" from scratch in Xcode 4 and added it to my workspace, with the same result. I looked at Apple documentation and watched the 16 second video about a dozen times now, but cannot work out what I am doing wrong (if the problem is indeed in the chair and not in the computer).

McKrassy
  • 961
  • 2
  • 10
  • 19

5 Answers5

95

I had this exact same problem. I think it stems from having another workspace already open referencing the project you want to add. I got it working by:

  1. shutdown xcode completely
  2. double-click the workspace to launch Xcode and open just that workspace
  3. drag and drop the project file from the Finder

Worked fine. I have many workspaces all referencing an openssl project, and it seems to work OK when you only have one workspace open at a time in Xcode.

rayascott
  • 1,012
  • 9
  • 9
  • 1
    Excellent. For whatever reason, that did actually work. Thank you. Now all I have to do is to figure out how to setup the dependencies between those projects... – McKrassy May 10 '11 at 10:58
  • Thanks, I thought I was going crazy – geekinit Jul 01 '12 at 21:56
  • Guess it must treat open solo projects as workspaces behind the scenes at some point. – Ryan Poolos Aug 02 '12 at 19:46
  • Even if you’ve the project open you want to add to the workspace as a normal project, Xcode will just add a reference without a file tree. In this case it’s also sufficient to just close the project window before dragging or adding the project bundle file to a workspace. – Rafael Bugajewski Nov 01 '12 at 17:58
  • There are lots of bugs in xCode thanks for sharing helped me :) – Aadil Keshwani Feb 11 '15 at 09:00
  • '1. shutdown xcode completely' is the important step :) Thanks – Yusuf K. Jun 24 '15 at 08:06
13

Actually, I made it work without exiting Xcode. All you have to do is make sure the projects you want to add are closed, since Xcode is having trouble adding open projects to a workspace. So:

  • Close the projects you want to add
  • In the Workspace window, choose "Add Files to MyWorkspace"
  • Add the .xcodeproj file of the project you want to add
IncrediApp
  • 10,303
  • 2
  • 33
  • 24
7

I had the same problem. SO I just exit xcode, restart it. Then I can see the files under the project.

Emmy
  • 3,949
  • 5
  • 28
  • 30
1

Exiting Xcode completely and then double-clicking the .xcodeproj file to open the project.

Himanshu Mahajan
  • 4,779
  • 2
  • 36
  • 29
0

It works but when you add an activity to the project than r.java file is automatically removed and errors are coming.

shA.t
  • 16,580
  • 5
  • 54
  • 111