Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode hangs while opening a specific project

Tags:

xcode

freeze

When I try to open a specific project with XCode, it hangs. When it hangs, it shows the following screen: image

Other projects can open fine, although the project that hangs opens too, meaning I can't do anything. My CPU is running at full speed (the fan starts going), and I have to quit multiple processes named "Interface Builder Cocoa Touch Tool."

I've tried...

  • rm -rf ~/Libraries/Autosave Information
  • rm -rf /Users/scott/Library/Developer/Xcode/DerivedData/*
  • rm -rf ~/Developer/XCode/UROPv6/UROPv6.xcodeproj/xcuserdata
  • rm -rf ~/Library/caches/com.apple.dt.Xcode
  • Reinstalling XCode.

I can't open the XCode preferences - UROPv6 (the project that hangs) always opens, so all of those options are thrown out the window.

The app that hangs is an iOS project. I've looked at this blog post, but I am using *.storyboard, not *.xib.

Since none of the above methods worked, I think I have some file in my project that's causing this. How do I open the project?

For the full error log when XCode crashes, see this gist.

like image 674
Scott Avatar asked May 20 '13 13:05

Scott


2 Answers

rm -rf ~/Developer/XCode/UROPv6/Reconstruct.xcodeproj/project.xcworkspace/xcuserdata worked. When I tried to run git checkout 0ea13d, it said `error:

Your local changes to the following files would be overwritten by checkout:
Reconstruct.xcodeproj/project.xcworkspace/xcuserdata/scott.xcuserdatad/UserInterfaceState.xcuserstate
Please, commit your changes or stash them before you can switch branches.
Aborting`

So I deleted that folder, and now it works.

like image 96
Scott Avatar answered Oct 19 '22 23:10

Scott


Scott, you might consider a more comprehensive .gitignore file. The xcuserdata folder can be (should be?) ignored by git under most circumstances.

Here's a sample .gitignore file you can start from, which will exclude most of the stuff that doesn't need to be in your archive, some of which can cause weird issues from time to time, or which merely takes up space in your archive without contributing any value. This sample includes lots of older control files from Xcode and its ancestors which you might not think you'll encounter, until one day when you import a class, library, or framework from a project with deep roots.

I put this together and shared it on a blog several years ago (A better sample .gitignore for Xcode iOS and OSX projects) based on the philosophy, "if it's a temp file of any kind, if it typically ought not be in an archive (e.g. a Sparkle private key), or if it simply isn't necessary (e.g. various intermediate build products), exclude it".

If you don't like this one, take a look around and find one you like. There are derivatives of this all over the web, now (including a cool one implemented as an Xcode script that creates the file in whatever directory you like), as well as others with different (minimalist) philosophical approaches, and some with more detailed comments.

You can put a .gitignore file at the top level of any git archive and check it in, to enforce the ignore for all team members. You can also put it on your system as a global ignore file for yourself, in case you create a project and forget to add the ignore file before the initial commit.

LINK: How to make a global .gitignore file

sample .gitignore file for Xcode iOS and OSX

# Mac OS X Finder and whatnot 
.DS_Store
.Trashes

# Sparkle distribution Private Key
dsa_priv.pem

# Xcode (and ancestors) per-user config 
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser

#  Whitelist the Xcode defaults
!default.mode1
!default.mode1v3
!default.mode2v3
!default.perspective
!default.perspectivev3
!default.pbxuser

# Xcode 4 - Deprecated classes
*.moved-aside

# Generated files
VersionX-revision.h

# build products 
xcuserdata/
DerivedData/
build/
*.[oa]

# Other source repository archive directories 
.hg
.svn
CVS

# automatic backup files
*~.nib
*.swp
*.lock
*~
*(Autosaved).rtfd/
Backup[ ]of[ ]*.pages/
Backup[ ]of[ ]*.key/
Backup[ ]of[ ]*.numbers/
like image 21
Gary W. Longsine Avatar answered Oct 20 '22 00:10

Gary W. Longsine