Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 build schemes screwed up every time I change branches in Git

Tags:

In Xcode 4, when I'm working when an iOS project, the Scheme drop down menu in Xcode's toolbar normally displays a scheme for iPhone X.X Simulator, iPad X.X Simulator and iOS Device.

When changing branches after having done something that affects the *.xcodeproj/project.pbxproj file, all my schemes disappear from the scheme drop down. If I close the project and reopen it, they come back. This is extremely annoying.

Here's what I'm doing:

  • Create a new iOS related project
  • Stage + Commit everything in the master branch
  • Create & switch to a new branch
  • Add a new class to your project and Save All (CMD+S+option) or just build the project to save everything.
  • Commit that change
  • Switch back to the master branch

At this point, my schemes are screwed and I have to close the project and reopen it to get them back.

Here's what they look like at the beginning: enter image description here

Here's what they look like after following the steps I listed: enter image description here

Does anyone know of a way around this or is this just a bug in Xcode? I submitted a bug report to Apple about it months ago and have not received a response. I've also received no response to a question about it in the developer forums.

Update: If you have a project with multiple targets, only the schemes for the selected target get screwed up after switching branches.

Update: Here's my .gitignore

# the build
build

# temp nibs and swap files
*~.nib
*.swp

# OS X folder attributes
.DS_Store

# user-specific XCode stuff
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
like image 707
George Avatar asked Dec 02 '11 19:12

George


1 Answers

This happens every time for me. It's most certainly a bug. I just click in the build target version box (5.0, etc) and then out again and it resets itself. No need to open and close the project.

like image 155
Dylan Gattey Avatar answered Oct 12 '22 05:10

Dylan Gattey