Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems adding Projects to Workspace in Xcode 4

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).

like image 283
McKrassy Avatar asked May 06 '11 07:05

McKrassy


People also ask

What is the difference between workspace and project in Xcode?

Workspaces Extend the Scope of Your Workflow Although a project can contain references to other projects, working on interrelated projects in Xcode 3 is complicated; most workflows are confined to a single project.

Do I open Xcodeproj or Xcworkspace?

The xcworkspace is created by cocoapods and needs to be opened instead of the xcodeproj. So that xcode resolves dependencies properly.


4 Answers

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.

like image 105
rayascott Avatar answered Oct 05 '22 06:10

rayascott


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
like image 36
IncrediApp Avatar answered Oct 05 '22 07:10

IncrediApp


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

like image 31
Emmy Avatar answered Oct 05 '22 06:10

Emmy


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

like image 37
Himanshu Mahajan Avatar answered Oct 05 '22 08:10

Himanshu Mahajan