问题
Is it possible to manually recover files from an Xcode (4.3.2) snapshot? Xcode crashes whenever I try to restore a snapshot, so I guess the files are corrupt somehow. I cannot find the snapshot image referenced elsewhere: ~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage
However, I have found a file that ends with .xcsnapshots
Is it possible to recover project files using the .xcsnapshots file? If so, how? I cannot make any sense of it.
回答1:
Are you able to export the snapshot? Exporting a snapshot is similar to restoring it. The main difference is that exporting a project's snapshot restores it to a folder other than the project's current location.
To export a snapshot, open the Organizer and click the Projects button at the top of the Organizer. Select your project from the left side of the Organizer. Select a snapshot. Click the Export Snapshot button to export the snapshot.
Xcode 4 uses the .xcsnapshots file to store snapshots for a project. When you select a project from the Organizer, the Organizer shows the location of that project's snapshots. Next to the location is a small button with an arrow. Click the button to show the .xcsnapshots file in the Finder. Select the .xcsnapshots file in the Finder, right-click, and choose Show Package Contents to show the contents of the .xcsnapshots file. From what I can see the .xcsnapshots file is a git repository. I didn't see any way to access an individual file from the .xcsnapshots file using the Finder, but you may be able to locate and recover a file using git from the command line.
来源:https://stackoverflow.com/questions/10311146/manually-recover-files-from-xcode-snapshot