Choosing "Discard all changes..." from the Source Control menu has no effect, although I am still able to open Commit dialog, then discard changes individually. Anyone know if this is a bug or if I should be doing something different?
EDIT: I have noticed this happens to me when opening an .xcodeproj, but not when I open an .xcworkspace
I resolved this problem by uninstalling and reinstalling Xcode. It doesn't seem to fix the issue on files created before the reinstall but all new projects now seem to behave properly.
This also resolved another issue where pushing to GitHub wouldn't work after the initial link and remotes would always show as "loading..."
Related
Problem:
When I hit "Commit..." under the Source Control menu in Xcode, the window comes up blank and I get a colorful pinwheel that doesn't stop spinning, so I have to force quit Xcode.
Details:
It's not a problem with Xcode in general because I can still commit other projects.
The version editor still works (I can still see previous commits I've made).
I've let the pinwheel run for over an hour, and still nothing happens.
I was able to commit this project up until a couple months ago. Since then, I added a few files to it, edited it a bit, updated Xcode if I remember right, and updated macOS.
Some of the files I added came from other projects.
I've tried removing some of the files I added and then committing, but that didn't work so I added them back.
I've tried cleaning the project, restarting Xcode, and restarting my mac.
I don't know much about source control, but I don't have anything fancy set up with a team or anything, it's just a local repository.
I've tried suggestions to delete various things inside the .xcodeproj file, to no avail.
I have Xcode 9.4.1
Any ideas?
If you have added big files (larger than 100mb) then sometimes Xcode has trouble with them. Try unstaging your commits and then committing them again. Finally try reverting back to the most recent version of your project and working from there.
I had the same problem. Sometimes selecting "Fetch and refresh status" works. The next time you go to commit the files will show up.
I found that rebooting my computer fixed the problem.
I was testing out some new swift code. I knew that if I made any mistake I could simply revert back to my old code by pressing Command+Z.
But I accidentally closed my Xcode Editor while writing new code.
How would I undo the new changes and go back to my old original code? I did not make use of github for this.
There might be a chance you can view the file's old history. Check out George Marmaridis' answer
Here is what he says:
You might not be out of luck. Although Git can't help you, Finder may be able to come to the rescue!
If you have not turned off the Versions feature (which by default is turned on and you need a Terminal command to disable), then do the following:
Quit Xcode.
Open the file you wish to bring back your lost changes to using TextEdit.
Go to File > Revert To > Browse All Versions...
Scroll through the available versions. Hopefully you will have many available to choose from.
Select a version and hit Restore.
Follow 2-5 for all necessary files.
Launch Xcode. You should now see the M next to these files in Project Navigator indicating they include uncommited changes (the changes you previously discarded).
I've been working on a project the last few weeks in Xcode and everything's been great. Main.Storyboard all of a sudden, will not load or open. Other projects open fine. There hasn't been any significant changes in this project. The last thing I tried doing was adding a navigation bar to one of my view controllers, to add buttons or items. I also tried adding a navigation item. Things started to complicate after trying to do these things. I have the latest version of Xcode, my project settings are linked correctly and tried rebooting my Mac but it doesn't solve anything. Does anybody know what may have caused this error and how to resolve?
The easy way:
Check out the latest working version of the storyboard file and try the changes again. Likely something odd and transient happened that corrupted the existing storyboard file (I've seen it happen with managed object model files before which are also XML underneath).
If there are too many changes to redo them:
Make a copy of the current storyboard file outside the repo and then checkout the latest working version of the file from the repo.
Diff the two files moving over changes that make sense from the troublesome file keeping an eye out for balanced tags (i.e. if a view has an opening tag but no closing tag Xcode will get confused).
Try opening the modified storyboard in Xcode. With luck it will open and be fine. Otherwise you will need to do a bit more digging or go back to option one and redo the changes.
I downloaded your repo and I can open Main.storyboard just fine:
First, there's one old question with the same issue, but since the answers don't work for me, i'm posting this one:
I had problems to open an old project at all. So i deleted xcuserdata and the derived data, from the options tab, too. This one worked fine and i was able to open the project, but now when i click on the storyboard Xcode "hangs" and i have to force it to quit.
This happens only if i click on main.Storyboard, every other file in the project works fine when i click on it.
The last thing i tried was to run the project and in the last 5 minutes, it says Compiling 2 of 2 Storyboard files and that's all; no other result at the moment.
edit: cleaning the project doesn't work too.
edit2: It seems the problem is with my Xcode, not the project. I created a new project and Xcode freeze when i try to open the storyboard. Same with some other old projects.
Next step: reinstalling the Xcode.
Ok, like i comment previously, i tried a lot of things before consider to reinstall Xcode, but the most important were to run the project in other Mac and when i saw that there was no problem to show the storyboard i concluded that the issue were in Xcode.
I reinstalled it and it works fine.
Before everyone does that it's probably a good idea to see if your project run on other mac.
You can also delete xcuserdata, the derived data and the Xcode saved state.
Among the other things i tried:
I restored the version of main.storyboard i have on time machine, just before the crash. Didn't worked, but worth to try.
I also considered to replace the file with the same but from some old version. But the problem was, that i've made too many changes on the actual storyboard, so i needed to find a way to restore it.
Recently, while developing an app for iOS, XCode has begun to exhibit buggy behavior that hasn't gone away even after reinstalling my entire Mac (which leads me to believe that something in the project settings may be causing this). In the left panel, switching to a pane other than the Project Navigator then switching back to it causes Project Navigator to expand ALL of the folders in my project. In addition, if I attempt to make a new group by right clicking and selecting New Group, a new folder shows up momentarily, then disappears again. The .pbxproj file is modified as well, but the new folder doesn't show up even if I restart XCode. Has anyone been able to fix this before? I wasn't able to find any posts anywhere relevant to this (it's kind of a hard problem to Google...). Thanks!
Update: I tested the bug by creating another app; the new app didn't have these issues, so I concluded that the project I made must have been corrupted somehow. I deleted and re-cloned the project from GitHub, which fixed the problem. Something went wrong with Xcode's settings for my project; I'm curious as to what the problem was, so if anyone has had experience please let me know!