HyWhen trying to refactor storyboard, it seems I have accidentally broken local git. Now it didn’t show a “current” branch anymore. All the branches I have are still there. I can also branch from existing branches, but I can’t make new commit. There’s no “A” or “M” when I made changes to code. There is still the blue lines indicating where you made changes in code files. What do I need to do to get got to work?
Here’s how I come to this situation:
I tried to refactor Main.storyboard. Selected a few Controllers, Editor->Refactor to Storyboard
I didn’t check at the time, but I believe the “Where” was set to “Base.Iproj” by default.
The new storyboard ended up not in the right place. Since I can’t “undo” this refactoring, I deleted it.
Committed the two code files I modified, deselected the storyboards and another file I didn’t remember the name of and hit commit. Then I discarded all changes from “Source Control” menu.
This break the code. Build failed.
So I checked out the newly committed one, didn’t work.
I checked out the one before. This time the build was successful. However, git stopped working like I described above. No “current” on any branch, and when tried to commit, it didn’t show any error. It simply didn’t have any effect.
However, when I tried to commit, the refactored storyboard that I have deleted showed up in the selection window with a checkbox, inside that base.Iproj folder. But I have go into my project folder and checked, there is no such file in that folder.
This is really not code related and all I did that broke git was listed above. I wonder what I have done so wrong that git is rewarding me with this maddening malfunction but more importantly, I need the local repository to work. Appreciate any help.
I’m using Xcode 10.2. I have tried restarting the Mac, XCode, and the project. None worked.
Related
I made a branch in Xcode some time ago and then forgot to switch back when I merged that branch on GitHub. I realized this and changed my local branch back to master, but it's old and there's 75 changes to pull. When I try, I'm told there are conflicts. Looking in the source control pane's Changes panel, I saw two text files with the C, I assume these are the issue.
One of the files did not exist in the project (at the time of the branch), so I added it and it said it had a conflict in the project view. The file was fine though, so I marked it resolved.
The second file was in the project. Here's the problem: it says it is conflicted in the source control view, but not in the project view. Unfortunately, you can only mark it resolved in the source code view, and since it says no conflict, I can't mark it off.
Any ideas how to clear this?
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 have renamed my project name, And it is working fine to me and building successfully. And I committed these changes to my Server, other person working on same project with different branch.
So, Once he got pull from server xcode asked him "Revert" or "Keep Xcode version", we selected revert option, then code project name came as red colour and files not showing.
We tried somany ways to fix this, we are not found any solution, can anyone suggest us to fix this issue.
For renaming app name,
I have just renamed the appname.xcodeproj in left panel of xcode and then created new scheme.
We are using Gitlab source control.
I will suggest to take a new clone.
When you are adding complex project structural/configuration level changes, then it is always better to take a new clone to avoid the misleading behavior. Merging the remote code will create a conflicts with local project workspace and behavior may weird.
I'm just starting to learn Swift using the Apple Xcode IDE. I made a little test iOS app and was trying various things when I inadvertently deleted my main code file (ViewController.swift). "No problem", I thought, as I had hit "Save" just a couple of minutes before. I exited out, then came back in, but it appeared to have autosaved.
I don't really care about this test file, but am wondering what is the proper way to save a project before trying something out (or before inadvertently pulling a bonehead move)?
What happens when I “save” in Xcode IDE?
When you hit "Save" the changes you've made are saved to disk. XCode doesn't do this automatically. If it crashes you may lose all your code written after the last time it was saved to disk. But XCode saves the changes to disk even without hitting "Save" button in some cases.
Xcode automatically saves changes to source, project, and workspace
files as you work. This feature requires no configuration, because
Xcode continuously tracks your changes and saves them in memory. Xcode
then writes these changes to disk whenever you:
Build and run your app
Commit files to a source code repository
Close the project
Quit Xcode
https://developer.apple.com/library/archive/documentation/ToolsLanguages/Conceptual/Xcode_Overview/UsingFileSaving.html
Use Git. If you don't know what it is, look into it. In the mean time, here is a tutorial or two.
To use it in Xcode, when you create a project, be sure to create a git repo:
Then be sure to commit frequently. Xcode has a built in Git GUI, so that makes it easier:
Then if you do anything that you shouldn't have you can either discard all changes (see the above screen shot, or if that can't help you, you can:
Open the 'Terminal' app
cd to the directory with the project
Run git log
Find the commit before you ruined everything
Copy the commit hash
Type q to exit the log
Run git reset --hard <THE-HASH-YOU-COPIED>
That should do it for you.
When creating a project check 'create git repository on my mac'.
Then commit changes when you're finished with one minor part and give the commit a comment so you know when looking into the history what changes you have done (quick overview).
With git you can quickly revert changes and go back to certain revisions like you can do in TimeMachine.
Further information are available at git's webpage.
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: