Tutorial :Xcode : Recover complete project from snapshot?



Question:

today I am playing a bit with the Xcode snapshot feature and I wonder if I could recreate a complete project from a snapshot if all code is lost.

It seems to me in the Snapshot-Manager I can only see snapshots of the current project, not of all projects. So if my projectfile is lost or damaged is there anyway to recover my files from a snapshot?

I also wonder were the snapshots are saved. Not in the project folder I found out already.


Solution:1

Go to the "Projects" tab in the Xcode Organizer and select your project. You should see all the snapshots that have been made. Select the snapshot you want to restore to and select "Export Snapshot" to save it somewhere to disk. What you export to disk is your "recovered" version of your project.

I agree systems such as SVN and Git are far superior to Xcode's snapshot mechanism for version control. However, the snapshot mechanism can be very useful. For example, I just made a change to a project. Before making the change, Xcode asked me if I'd like to take a snapshot. After the change it turned out that I didn't want to make that change and so I used this mechanism to restore the project to the prior state.


Solution:2

Before trusting Xcode snaphot feature too much, may I suggest you to consider source code management with CVS, SVN or Perforce (integrated in Xcode)?

For me, the main usage of snapshot is during a refactoring session: You create a snapshot before applying refactoring changes, so that you are able to revert your modifications.


Solution:3

Have a look in your home folder:

~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage  

Within this you'll find the project snapshots.

But, you're better off using a proper source control system


Solution:4

Since there has been some remarks concerning version control systems. I would really advice to give git a chance. If you include the xcode specific files into the git repo, then you have the same effect as the snapshot mechanism.

So if you have a project that is not git controlled at the moment you can just use one of these howtos to create a git repo:

Using Git with an existing XCode project

And then don't forget to add the .xcodeproj directory and things should be a bit smoother.

I really dislike Linus Torwald at times, but git is just the best VCS I ever came across.


Solution:5

This document explains how snapshots are restored: http://developer.apple.com/library/ios/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/SCM/SCM.html


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »