Tips for when your Xcode/beta crashes when you try to run.
TLDR: Xcode was crashing after building successfully but before running. Deleting my User Prefs fixed my error, but I’ve listed the steps I tried, and some other best practice options below.
My problem was this: Xcode 8 beta 2 arrived, and I went merrily on my way playing with all the great stuff we learned about at WWDC.
However, everytime I tried to build and run in the new Xcode beta 2 (and later in beta 3) I would get a successful build and then the whole program would crash without opening the simulator or deploying to a device.
I talked to a lot of people in my knowledge network, and did all sorts of searching on the error I was getting:
“Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFYApplication Specific Information:
ProductBuildVersion: 8S162m
_ASSERTION FAILURE_ in /Library/Caches/com.apple.xbs/Sources/IDESpriteKitSupport/IDESpriteKitSupport-11049/Foundation/Classes/Document/SKEditorDocument.m:201”
This was strange, because the app I was working on was not using SpriteKit at all. It was from a tutorial from Paul Hudson from his new Practical iOS 10 book. (which is great so far, fyi)
To test that it wasn’t something I’d done in the project, I made a new blank one, cleverly named ‘dontcrash’, and tried to build and run it. Xcode crashed again.
I actually ended up with several blank apps: dontcrash2, dontcrash3 dontcrashXcodebeta3 and finally- CrashyApp, before I hit on the solution.
Basic Options for Xcode Crashes
- Clean the project.
- Target a different simulator you haven’t tried with the project yet.
- Delete Derived Data directory
- Delete app, re-install.
- Delete User Preferences
- As mentioned here: http://stackoverflow.com/questions/31354850/xcode-7-beta-3-crash-at-startup
- Note: Deleting the app and reinstalling does not remove the user preferences.
- This fixed my problem.Not sure how my prefs got confused in the first place.
Advanced options (I didn’t get this far)
- Monitor memory usage in the Debug navigator
- Inspect a few malloc generations in Instruments