projectios11xcode9icloud-drivexcode-workspace

Xcode 9: How do I re-associate a project with a workspace?


I am working on a workspace that contains my project and my CocoaPods. I keep the whole thing on iCloud and work on it from my desktop and laptop. Everything has been working fine until recently when the workspace shows my project files on my desktop but not on my laptop. All of the pods appear on both devices.

Desktop vs. Laptop

Importantly, all of the project files are still there on my laptop and continue to sync perfectly with my desktop over iCloud:

Project files on laptop:

I know this problem was caused by using iCloud for syncing. The question is how do I re-associate the project with the workspace on my laptop so I can continue to work on my app from both devices.


Solution

  • I figured it out. It seemed risky at first but it worked. I am posting the solution here in case someone else has the same dilemma. Back up everything before you attempt.

    1. On the laptop, in the navigator pane, I clicked on '+' and selected 'add files to ...'. Then I selected my project file within the project folder and added it. This added the project back to my laptop, but I ended up with 2 copies of the project on my desktop computer associated with one workspace.

    2. On the desktop computer, I deleted one of the projects and sent it to trash. Both copies of the project disappeared in the project navigator.

    3. On the desktop computer, I opened my trash and dragged the project file back into the project folder. The project then showed up in the navigation pane.

    Everything is now working perfectly on both computers and I can continue to use iCloud to work on my app from either device.