How to prevent Xcode 4 from crashing with git branch when the project file changes? - xcode

When the project file is different between two branches (say, we added a new source file), switching git branches causes Xcode 4 to crash. What's a good solution to this?

I've noticed the same thing. The only workaround I've found is to close Xcode, do any branch changes I need, then reopen Xcode. Not the best solution, especially if you're switching branches frequently, but it seems to work. Ultimately it's probably something Apple will have to address as Joshua mentioned. Good luck!

If it's crashing, it's a bug and needs to be reported to Apple via http://bugreporter.apple.com so they can fix it.

Related

Xcode creating tangled git repositories

I'm attempting to learn git and Objective C - yes, I know Swift is out there. I'm waiting for the excellent BigNerdRanch to publish a book on the topic. And since I have their other book I think it's good for me.
Anyway, I've been creating projects and checking the box for Xcode 5.1.1 to create git repositories on my Mac. For the last 2 projects what I find is that they are tangled up. What I mean is that when I go to the command line I see multiple Initial Commit's that were NOT done for that project.
If this is fixed in Xcode 6 - I can wait. Just curious why this is happening.
These are stored in Dropbox - could that be related? I'm about to reboot and shut down. Maybe somehow git is still open and pulling in everything?
Thanks!

Git is seeing changes I didn't make in xcode

I'm programming in xcode (actually Phone Gap in conjunction with xcode) with git. I'm having a strange issue. When I create two identical branches and try to check out back and fourth between them with out making any changes git is telling me that I need to commit because a change has been made (this same thing is also resulting in merge conflicts). It says the changed file is:
platforms/ios/Butterfli.xcodeproj/project.xcworkspace/xcuserdata/benpearce.xcuserdatad/UserInterfaceState.xcuserstate
Can anyone explain what's going on and how to deal with it.
Yes, .xcworkspaces are simply files that Xcode uses to describe the workspace or projects.
IMHO, There's no need to check these files in at all, unless you share settings with other folks in your projects (and in your case, I suppose other machines that have a user named "benpearce").
In fact, you can safely add them to your .gitignore file.
More info can be seen here

Workflow for XCode & Git sharing code?

What is the best practice / process for sharing code using git between developers working on an iPhone application.
Everytime I follow the normal git-fetch, git-rebase origin/master, method from the command line I get conflicts in the .xcodeproj, .xib, and Storyboard files.
The .xib isn't so bad because its ussually easy to fix, however the .xcodeproj consistently corrupts and I haven't found an easy way to consistently fix it.
What's the best workflow to share project files and resolve conflicts with git?
Conflicts in project files are always a pain. The same thing happens in .NET development and Visual Studio. The best way to handle this is to not have too many changes to merge at once. You do this by merging in each other's changes on an integration branch. To keep branches clean, you don't merge that branch or the other person's back to yours. You rely on rerere to remember all your conflicts along the way. This is the workflow I use:
http://dymitruk.com/blog/2012/02/05/branch-per-feature/
If you really get stuck, you would likely look at what changes were done on the other side (what you're merging in), checkout your version of the project file, manually do what the other branch did to the project file, and then use that as the solution to the conflict.
The issue is that the IDE is doing it's own thing when you update your project. So sometimes, you need to manually use the IDE to simulate adding all the stuff yourself and using that file as the conflict resolution.
This is the dark side of using heavy IDEs for development.

Xcode 4 and version control - But which one?

I have a question, the answer isn't really hard technically, but I am more looking for the experience of most advanced programmers here.
So like many noobs, I am doing my version control in the crappiest way, which is to copy paste my project directory and rename it with the current date/time.
You will agree that it's a quite limited solution :P
I decided to learn version control system(s), but I am facing many choice, and I would like to know what are the best for your points of view ?
Using Xcode integrated version control (git or anything else), with organizer, cloning, commits from xcode etc. I mean totally or almost controlled by Xcode ?
Ignoring Xcode letting him think there no version control and doing it myself in command line ?
A merge of the two above ? How ?
And then :
Using git ? Github is very popular and powerful, but you must learn git, and learn it hard.
Mercurial ? It seems more friendly.
Something else ?
It would be priceless to have some feedbacks about more experienced people, so that me and many others I hope can choose their paths when facing the VCS wall :-)
Thanks a lot !!!
First: Use a VCS at all.
The rest:
Mercurial is nice, but Apple went with Git for Xcode. So if you want source control integration within the IDE, Git is the best option.
The things I miss most when working with Xcode & Mercurial are the "Modified" indicators in the source list and the integrated diff-viewer. (Which is pretty good in Xcode IMO)
The actions you perform in the Organizer are a bit limited at the moment, but you can always fall back to Terminal.app for that.
I can only recommend git. Merging is easy, I remember the days when a merge conflicts occured with SVN, it was pain, horrible pain to resolve those. You can easily start a local repository with git, especially if you are the only one developer.
Have a look at Which SCM system to use with Xcode 4 for a lone developer?.
I suggest some reading on git for the beginning:
Git in five minutes
Git Community Book
The Thing About Git
Take some time to invest in learning the basics of git, it's absolutely no rocket science to get you started on basic usage and you will benefit from it right away. Once you know the basics of git, you aren't locked into another tool wrapping git, you can use git if there are some problems with XCode. Also, git is available for several OS so the knowledge you gain about git will not go away if you move between different computers that have different OS.
Here are my best of bookmarks for git:
http://www.delicious.com/Ralphtheninja/bestof+git
I've had good success with SubVersion.

svn conflict xcode project file while working in team

I'm working in a team that's developing iPhone application (about 7 people). We use SVN for source code control of iPhone code, we keep running into conflict issues with xcode project file and iPhone nib file. I think there has been a question asked about this problem : How to merge conflicts (file project.pbxproj) in Xcode use svn?. I want to ask if anyone has ever come up with a satisfactory solution to this. Since our team is fairly decent in size (7 people), manually resolving conflict in xcode project file everytime someone changes code, or adding new object into nib file is a huge productivity waste. Has Apple engineers ever thought about this issues when they wrote their own iPhone apps ? I have been looking for a satisfactory solution using Google and Bing, not yet found one.
Thanks,
This is definitely a HUGE flaw with xcode. I'm on a team of similar size and here's what I do to make the process as painless as possible:
SVN update (ALWAYS do this before a checkin as well):
quit Xcode. The quickest way to do this is to use Alfred and type "forcequit xcode"
"svn up" in the project folder from command line
If you have any merge conflicts with the project file, hit "edit" to open in emacs or whatever
search for "======" to find merge conflicts; delete that line as well as the "<<<< mine" and ">>>>" lines
save & exit. hit "r" to mark project as resolved.
re-open project - "open MyProject.xcodeproj/"
With a bit of practice you can get this process down to under a minute (I do this several times a day).
for NIB files, DO NOT work on while someone else is working on it. There's no real way to merge them. Make your changes quickly and check in right away (there aren't many cases where 2 people need to work on a NIB file at the same time anyway). For less complicated views, just lay them out programmatically.
Try installing SourceGear DiffMerge. This is a merge tool that should make it a lot easier to merge the changes. Also see this blog post about configure XCode to use DiffMerge

Resources