Unable to create snapshots with XCode - xcode

I am unable to take any more snapshots of a particular project of mine in XCode. If I try to create a snapshot, it says 'Creating snapshot ..' in the status bar and goes on forever. I then force quit the Xcode, relaunch and try creating a snapshot again. This time it straight away gives the error message '..remove file manually .. ...lock'. So I then remove the shown file using the rm command in terminal. And then I again try creating the snapshot and the same cycle continues.
How can I fix this issue?
I had been taking snapshots for this project for a long time and one day had to delete all the old snapshots as I suddenly realized that they are taking up 12+ GB! Even now if I try to create a snapshot for this project it reaches 3 GB in a few minutes and then I force-quit it.
(I am pretty certain this used to work perfectly until some time back and didn't take gigabytes in space.)

Since you tagged this question git, I suspect git is the cause of your problem. I have found Xcode snapshots do not work if the project is in a git repository. If you need to take a snapshot, a workaround is to move the .git folder out of your project temporarily, take the snapshot, and move the .git folder back.

I too had the same problem and this is how I fixed it:
I noticed in Xcode -> Organizer -> Repositories that my whole ~/username folder was showing up as a repository. I tried deleting it in Xcode but it kept returning. Previously, before I had installed Xcode 4, and using Xcode 3, I had installed GIT and cloned opdenkamp/xbmc to my home folder. Through a lack of knowledge on the use of GIT, I had made my whole folder a repository and every time I tried to make a snapshot of my project in Xcode it was making a snapshot of ~/username (or some other process) that was taking for ever and creating a multi GB file in ~/Library/Developer/Xcode/Snapshots/ . In fact I would "force quit" Xcode to stop the process.
So I deleted the repository in Xcode, I quite Xcode then in the terminal I typed from my home directory ~/username
sudo rm -r .git
Probably not a good idea if there are repositories that you want to keep (which was not a problem for me) but now making a snapshot of an xcode project takes a second and generates a file that is of the order of the Xcode project and not now in the multi GB ball park

the easiest fix is to make sure you have "Enable Source Control" checked in Xcode's Preferences (Source Control tab)

Related

Xcode stuck on wrong git branch

When trying to change branches I got an error saying my credentials were bad. Since then, Xcode shows the wrong branch. When I'm in command line it allows me to change branches, pull, commit etc...
When I try to change branches in Xcode, it says the repository is locked.
There's no lock file in .git and I can change from terminal (xcode doesn't change)
I've wiped derived data, restarted etc...
I completely deleted the project and recloned from GitHub Enterprise.
For a second it seemed to work...
but I tried to change branches and my old branches showed up and I got frozen again.
had to clone to the same directory however
Where is this state being cached so I can delete it and start fresh?
EDIT:
I've completely deleted Xcode, redownloaded the version I'm using (10.3), deleted these caches:
sudo rm -R ~/Library/Caches/com.apple.dt
sudo rm -R ~/Library/Preferences/com.apple.dt
as per this answer: https://stackoverflow.com/a/52541405/4522329
After I was setup, I reconfigured my Apple ID and GitHub Enterprise Account and recloned a second time.
Again things looked fine, until I tried to change branches...
Then my previous local branches popped up again showing me back on an entirely different branch and any attempt switch throws a repo locked error.
When I run 'git status' from command line, tons of duplicate files were pulled in from some cache and I'm shown on the branch I expect to be. I can do whatever I want from command line (still no lock file in .git), but it's not reflected in Xcode!!!
Also the launcher screen on Xcode is showing older, formerly deleted projects. There's some Xcode cache that's trying to recover from somewhere...
So this was weird. Still not sure the underlying reason.
I was able to resolve by wiping everything out again, cloning to a different location opening up in Xcode and cycling branches from within the IDE and then cycling through a few from command line and confirming the IDE was updating.
After that I moved the project to it's previous directory address. When I opened Xcode the recents list had two entries for the project in that location. I cleared both, then opened by directly clicking on my xcworkspace.
So far so good.

After upgrading Xcode 6, the snapshots are lost

I've lost the all snapshots I created, and the current project is somehow buggy and cannot function properly since I've tried to add some new features and failed.
Can anyone tell me how can I go back to my functioning version now that the snapshots are lost? Or can I retrieve one iTunesconnect version that i can edit?
Thank you very much!!!
Xcode 5 stored Snapshots in ~/Library/Application Support/Developer/Shared/Xcode. Xcode 6 stores them in ~/Library/Developer/Xcode/Snapshots.
You could:
Try moving them from the old location to the new location and see if Xcode 6 will recognize them
Open Xcode 5 and revert your project there (you can download it from the Dev Center if you deleted it during install, or it might still be in your trash)
The installer shouldn't delete the snapshot files.
Also, for the future, you should use Git or another source control software and not rely on snapshots for this.

Xcode 4.0 hangs on loading project due to the corrupted repositories?

I was trying to commit some changes, Xcode was hang on bringing up the changed files. So I killed (Force Quite) the Xcode. Then next time when trying to bring up my project, Xcode just hangs on loading project. Firstly I thought that maybe my project file was corrupted, but it still the same behavior with my backup project file. So I guess that the default repository for my project is corrupted.
The question is - where is the location of the default repository for my project? can I "remove" it to see if Xcode can starts up properly w/o it?
In XCode 4, you'll find the output contents for the project ~/Library/Developer/Xcode/DerivedData
I'm having this issue as well, intermittently with several projects. I suspect Lion resume as at least part of the culprit as I've had some success with deleting the content at:
~/Library/Saved\ Application\ State/com.apple.dt.Xcode.Lion.savedState
I'm presently reinstalling Xcode to see if that clears things up. A very Windows thing to have to do, eh?
[Sorry for hijacking such a dated thread.]
When we stumble upon this issue (it happens a lot lately) we usually remove ~/Library/Developer/Xcode/DerivedData/YOURPROJECT_RANDOMSTUFF and restart Xcode.
Usually the hang comes along with Xcode using all available RAM and causing the machine to swap heavily.

Delete an unreferenced image from repository in Xcode

I deleted default.png from my resources folder because I wanted a different image for the loading screen, but I just deleted the reference which was apparently a dumb thing to do. I dragged the new image into resources and tried to change the name to Default.png, but it won't let me, which I think is because the first Default.png is still in the repository somewhere. Anyway, how do I delete that image(and others with which I have probably done the same thing) from the repository when it is no longer visible in xcode?
What kind of repository is it? Subversion? Git?
The SCM integration in Xcode is great for checking out files and committing changes without having to leave the IDE, but it's hardly a full-blown GUI front end to either svn or git. It may be possible to fix your mistake by adding the file back to the project and then deleting it in Xcode in such a way that Xcode will remove it from the repository for you, but the simple solution is to just delete the file from the repository yourself by using the appropriate version control command. For example, if you're using Subversion you could:
svn remove default.png
to remove the file from your version of the repository. When you commit your changes, the file will be deleted in that version. (It'll still exist in previous versions -- that's the whole point of SCM, after all.)
After that, you can create the new file and add it to both the project and the repository in the usual way.
You need to manually go into your app's file structure and delete the image files themselves. Also, it is usually a good idea to "clean" the app whenever you remove files or references to files from an XCode project, since XCode can be a bit temperamental about removing files; the key combination for this is
Hope this fixes your problem.
Clean all targets should work (at least it worked for me). You can try the following:
a) delete the reference from "Copy Bundle resources" of your target
b) delete the app from Simulator/Device
c) clean all targets
Caleb is absolutely right. That fixed the problem here as well for the most files.
An easier way to get an overview of the accidentally un-deleted files, is creating a bookmark of the working copy with Versions (SVN Software - in case you use SVN). There you can detect the problematic files grafically and delete them. I always have to do this after restructuring the project folder.

Remove project from SCM in Xcode

I have an iphone project on a mac. I set up an SCM repository and then ignored it for a while. Now I've decided to back up my source to my main PC and do source control there. I'm finding that the SCM wants to roll back my changes seemingly at random.
How can I kill SCM in Xcode on the mac? I need to tell it to leave my source files alone. Nothing is worse than making changes and having your changes replaced.
I work alone, but have about 10 projects in source control on the pc.
Thanks,
Gerry
if you want to remove svn from folder manually
check the .svn folder is deleted from your project
its in very directory and sub directory
Assuming your using Xcode: As long as you have all your files (and another back up) you can go to preferences, scm, and then just remove the repository.

Resources