My Storyboard Wont Open - xcode

So I went to sync my changes with Github and I ran into a few problems with main.storybaord. So I re opened Xcode, opened my project, and I saw a C next to my storyboard.
Now when I try to open it, nothing shows up except for an error message saying:
Interface Builder was unable to determine the type of
"Main.storyboard".
Please Help! Thanks!

The C means Merge Conflict.
You basically have two options:
revert to the last working revision
resolve the merge conflict by picking the correct change
The first one will revert all the changes that where made since the last commit. Right click the file, choose "Source Control" / "Discard Changes in ..."
The second one is best done from the terminal. Open the terminal, go to your project root and run
git mergetool
FileMerge will open, pick the correct changes in there.
Then do a
git commit
to commit the merge.

Related

What happens when I "save" in Xcode IDE

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.

xcode does not show files in the commit window

I have checked out a copy of a SVN project, I have modified some files and want to commit the changes. If I go to File > Source Control > Commit. I see an empty list and a button saying "Commit X files". I expected a list of the modified files.
Now, I use the command line tool (svn ...). But I want to bring back the Xcode commit window.
How may I fix it?
BTW. I'm using Xcode 4.6.1
That is a very very strange screen shot. Sometimes Xcode's svn integration can be a bit strange. If I were you I would just cancel out of the strange empty dialog and use svn at the command-line in Terminal instead.
In file > preferences there is a source control section. You probably have the check box checked to update the source control automatically. So, because it is already updating the source control, it doesn't let you do it.
So you can uncheck that box to make it not automatic, then change something in your project and try to commit the changes. You will probably see some files now.

How to ignore uncommited change in Github gui for MAC?

I am using Github GUI for Mac.
Now I've some changes in my local repository, but I want to ignore them and pull latest remote repository.
I tried Repository/Pull, but got Git Error.
"•error: Your local changes to the following files would be overwritten by merge:
Classes/xxx.m
Please, commit your changes or stash them before you can merge."
I tried Repository/Synchronize, but got following error.
"Sync Failed. Please commit all your changes before syncing."
Any idea?
Place a checkmark near each of the changed files, then go to the Repository menu and click Discard Changes to Selected Files.
If you mean using MAC GUI only, check and right click the changed files then select the discard the changes.
if you want to remove your uncommitted changes, just do a checkout on those files again.
Stash is super easy too though, and it keeps your changes in a local 'bucket' or stash :)
For those on Github for Windows, it is not obvious where Discard All Changes is, so I wanted to share this:
Select Files by using check mark next to names.
Right click on Collapse All/ Expand All button with two arrows. (This button is on right side of Files to Commit box, and under Sync and Gear icons.) This is where Discard All Changes is >hidden<.
Sorry but too low level to add comment to #Leo wangs or #aspiringwebdev chain above. You gotta start somewhere...

Xcode/Git Repository Error: "Please verify that the working copy is reachable and try again."

Here are the steps I take.
I open Xcode (4.3.3) organizer and select Checkout or Clone Repository
I choose the location https://MyUsername#bitbucket.org/MyUsername/myrepo.git
Press Clone button and it successfully clones it on my local disk
So I open the local copy of the project and perform some changes to it.
When I try to commit changes (or do any other git related operation) I get the following error:
The working copy "MyAppName" could not be reached.
Please verify that the working copy is reachable and try again.
However I can perform commits (and other types of git operations) without any issues from the Terminal app using command lines.
I've tried restarting my computer, deleting all Xcode settings, but nothing helped.
Update: I tried it again today and it works fine now. Maybe it's some sort of an intermittent bug in Xcode.
Whenever this happens to me (and it happens often) I do the following:
1-Close the project
2-Open the organiser
3-Go into the repositories tab.
If your current working copy has been added to the list already, then within the organizer navigate to it, and double-click on the .xcodeproj project.
This will re-open the project in XCode, and you'll find that now SCM operation will work fine.
If your current working copy hasn't been added to the list, press the + button in the bottom left corner, select "Add Working Copy", navigate to the folder containing the .xcodeproj and open this folder.
Now double click on the .xcodeproj file, the project will open in XCode.
And it's all working fine again...
No idea why this make things work... but it does
I have the same problem. It happens if you have ~/ in the path to project. Works fine, when you open your project from organizer.
It's a bug of Xcode! When you search the xxx.xcodeproj from your Home folder of the dialog box directly, Xcode will use the ~/xxx/xxx as the SVN/Git path which is completely wrong.
So you should avoid this, and search from the "/" path instead.
This is not exactly the answer you might be looking for, but I ran across similar problems when using Remote git repository (Github) and Xcode.
I ended up using a GUI tool "SourceTree", a good and easy to use tool to pull/push your code from Local Git to Remote Git Repository. Try it out http://sourcetreeapp.com/

Can't commit changes to local git repository

I have created a new project and checked the "create a local git repository" option. I opened the organizer to check that there is a repository for my project and it was there. I made some changes on some files, and noticed the source control specific letters "A" .. "M" beside them, but when I choose: File-> Source Control -> Commit, I get the following message from XCode 4.2:
the operation could not be performed because no valid working copies were found
Please verify that your files are under source control and try again
However, I opened the organizer again, and noticed that the repository of my project includes three icons on the left bar: Branches, Remotes and a folder with the same name as of the project. I chose the last one (the folder) and pressed the Commit button on the bottom bar of the organizer. The commit sheet opened and I performed the commit successfully. Now, when I close the organizer, and edit some files in my project, I do not see the source control specific letters "M" ... "A" ... beside each modified file.
My problem is about two points:
1) Why can't I commit from File->Source Control->Commit menu option
2) When I commit from the repository itself, and go back to the project and edit some files, why do not I see source control letters beside modified files?]
For what it's worth (and as #Jahelia's comment mentions), this seems to be a bug in XCode 4.2 when it first engages with git. The workaround seems to be to at least close Xcode and reopen. (If that doesn't work, try opening and closing the organizer.)
I encountered this myself today when trying out Git with Xcode for the first time. I created two demo projects with the "create a local git repository" option and they had the same problem. I was able to commit from the organizer window, but the main Xcode file view didn't seem to recognize git at all.
After quitting and restarting, I created a third demo with the git option, and the main window recognized the changes (after building) right off the bat - i.e showed the "M" beside a modified file.
I've experienced and recovered from this.
I can't tell you what causes it but, notably, in the "Repositories" view in my Organiser, I had TWO similarly-named repositories. What differed about them was the case of one of the paths.
One was "~/Work/Code/Bumhole" and the other "~/work/Code/Bumhole".
I caused the problem by XCode crashing during a commit to the repository (of many changes).
I fixed the problem by
closing the offending project
closing Xcode
rebooting
reopening Xcode
(close the project if its open)
open the Organiser view
Select the "bad" repository and delete it with backspace
Navigate the remaining "good" repository until you see the .xcodeproj file
Double click the .xcodeproj file to open the project
I expect this list is a superset of the steps needed to fix the problem, but this worked for me.
If your project is in /Developer/.... move it elsewhere and reopen the project. This may resolve your problem.
There seems to be a problem under Xcode 4.2 with projects in /Developer/... and git integration (you get the error "The operation could not be performed because no valid working copies were found. Please verify that your files are under source control and try again")
This bug still exists in Xcode 4.6.3 and when using Subversion.
I know this has already been answered but this worked for me:
Open terminal
cd yourprojectdirectory
git config --global user.email "youremail#email.com"
git config --global user.name "username"

Resources