Today I had a unique xCode scenario crop up that caused multiple files in my project to appear as missing (red in the project file list). First, the scenario…the project is held in a git repo and development is done using a modified git-flow technique. As such we are often merging feature branches in to the develop branch and vice versa.
After merging the develop branch in to a feature branch and then returning to the develop branch numerous source files appeared as missing. I verified the files still existed on the filesystem, deleted the files from the project and added them back in with no change in file status in xCode, they still appeared missing. I then deleted them again, re-added them to the project (still missing) and then tried to adjust the location setting of each file to be "Relative to Project". This did not work either. I made another attempt to add the files and then manually select the location of each file in the filesystem. Although the files were there xCode still showed them as missing.
Seeing no other option than to re-create the project file by creating a duplicate project with a different name I came across a fix. I created the new project and then proceeded to move all of the header files in to one of the new project's sub directories via the Terminal. As soon as the header files were moved, all missing .cpp files in the original project showed up (file names turned to black from red). I then moved the header files back to their original location on the filesystem and my original project was back in business.
I do not know what the underlying cause of this corruption was, but in the end the fix was to move the files out of their original directory on the file system and then move them back. Hopefully this saves another developer time trying to figure out why xCode chose to incorrectly mark some files as missing
Are you getting a clang error that you can't track down? "What the heck is 'clang: error: '-I-' not supported, please use -iquote instead'!?!" Oh compiler gods please help this poor soul. Well hopefully you haven't burned a day trying to solve this by tracking down project includes, compiler versions, and lord knows what else. The answer turns out to be head-slappingly easy, you've got an unsupported character somewhere in the project path. In our case we had something like this:
/Users/joeblow/Devel/Projects/WARU - Joe/testDir/waru/WARU.xcodeporj
Notice the hyphen in there, that was the cause of all the pain. The fix was simply to remove the hyphen:
Hope this helps someone out there!
So you're an early adopter, good for you, although many times it can bite ya in the behind. Xcode is a fickle mistress and the latest release of Xcode 4.3 is no exception. If you're like me and you've got it installed and are cranking happily coding and debugging, you might have run into a strange phenomenon that the debugger doesn't seem to show the variables and their values correctly. This caused me hours of heartache because I was thinking that I had something messed up with my inheritance in my classes and sent me down a wild goose-chase trying to track down why my members weren't being initialized correctly. The it dawned on me, "hey I just updated to Xcode 4.3, I bet somethings up..." Ding ding ding, give the man a booby prize. The problem is the debugger and compiler settings. I changed my compiler to use the GCC compiler ("LLVM GCC4.2") and the debugger to GDB and all was right in the world the next time around. After playing with the settings a bit more, turns out I didn't need to change the compiler at all, just the debugger.
The short version of this post is, if you're having difficulties debugging in Xcode 4.3, simply set your debugger to the GDB and you're good to go.
Good luck and be safe out there!
When I get off my lazy butt, I'll add these to the resources page, but for now here are a list of great resources courtesy of https://www.vfr.org/
Just a quick entry to remind people that XCode 4.2 is a beta product and consequently there are certain behaviors that aren't supported, including creating an ipa file archive. When you attempt to create the .ipa, you will get a "file or directory not found" error.
We have an ongoing conversation about the best way to manage our code-base and repository in Git and have found the best solution is by using this branching structure:
- 'develop' should always be in a compiling/working state, containing the most current completed features
- 'master' should contain only releases (e.g. build from here for app store submission)
- 'release/some_release_name' should contain releases in-progress (bugfixes only)
- 'feature/some_feature_name' is where most work should take place
- 'hotfix/some_hotfix_name is where we fix critical bugs on code that has been released (in master)
Feature branches are the only branches that can be in an indeterminate state, though I avoid intentionally checking in code that doesn't build. All other branches should build and run cleanly.
You can help enforce this practice through good discipline and by using Git-Flow. If you're on a Mac you can use MacPorts or Homebrew. There's also a pretty decent screencast showing you how.
Some comments from our developers and friends:
Yes. Basically, we should be checking in only code that works to 'develop'. If you need to save your latest progress, you should just create your local git branches as many as you like and when you are ready, merge with your local 'develop' branch and then push the changes to the remote 'develop' repo.
We've been using git-flow at ShortForm for about a year now an we love it. The gitflow extensions are also very nice, save a lot of manual branching and tagging as per the process :
There have also been a few moments where the process has broken down for us, but with git it's so easy to do things manually as well that it has not held us back in any way.