Hi, I'm new posting to this mailing list, but have been reading it for awhile to research problems.
One problem that's been cropping up a few times for me lately is a bug that will every now and again corrupt the Snapshot database, resulting in not being to add or restore from snapshots and an in an error similar to:
Unable to change file attributes for "/var/folders/SJ/SJD9LFS9F6ubEN0SQIDu-++++TM/-Tmp-/XcodeSnapshots/..."
There have been a couple posts about this, with no solution or workaround aside form deleting the snapshot archive and having xcode create an empty new one.
This has happened to me twice now, and this kind of takes away from an otherwise awesome feature built into xcode.
determined not to lose everything again, i started poking around and was able to restore all my snapshots. Here's how i did it:
1) go to ~/Library/Application Support/Developer/Shared/ (or where you set the Developer app support dir to be, this is the default) 2) move SnapshotRepository.sparseimage file (it may have a different name) to your desktop. 3) open up your project in xcode and open the snapshots window, then make a new snapshot. This creates a new sparseimage 4) close xcode 5) go back to ~/Library/Application Support/Developer/Shared/ and open the newly created disk image (this will be called New Image) 6) open the sparseimage that you moved to the desktop as well (this will be called Old Image) 7) you should have 2 disks mounted on your desktop now, both named Snapshots. One is from the New Image, the other from the Old Image 8) open the SnapshotArchive.plist file from the Old Image in a text editor and copy everything between the <array>...</array> (or you can use your favorite plist editor... i'm essentially copying all the snapshot keys from the old image to the newly created one) 9) close that plist, and open up the SnapshotArchive.plist form the NEW Image. Notice there's much less there, so now u can past in all the keys copied form the old image. Save this plist. 10) Now, copy the contents of the ArchiveDirectory from the Old Image to the New Image. 11) Unmount both Snapshots disks 12) open up your project in xcode, and open up the snapshots window 13) now you should be able to add more snapshots!
it seems that xcode loses track of the sparseimages (in my case, this happens whenever i close my laptop, putting it asleep, when i have a project open in xcode), and it needs a new one. So, i'm essentially just letting XCode create a new snapshot sparseimage, and then I'm copying over all the old keys and all the old version data.
As xcode calculates the snapshots from the SnapshotArchive.plist, it should be able to find all the old snapshots
hope this helps, it's saved me a lot of frustration.
-phong |