6

So Xcode 8 has been pretty buggy and seems to crash constantly when using the Sprite Kit scene editor and tile maps...

The error occurred while I had a scene open in the scene editor and was using tile maps.

Now I can't even open my project for more than 3 seconds without Xcode crashing... Kind of at a loss as to what to do...

I've tried uninstalling and reinstalling Xcode...but that did nothing.

Here's a pastebin of the crash report. Any help would be extremely appreciated.

http://pastebin.com/kDMjPYec

Corey F
  • 621
  • 4
  • 14

6 Answers6

18

Clearing the Xcode's derived data folder worked for me. you can find the derived data location in Xcode -> Preferences -> Locations tag.

krishnan
  • 782
  • 1
  • 9
  • 20
16

I had a similar problem (unrelated to SceneKit though) — Xcode would just crash when opening a certain project. Deleted my UserInterfaceState.xcuserstate file from under the xcworkspace directory and that solved it.

villapossu
  • 2,737
  • 4
  • 18
  • 19
12

I had this issue. Got it solved using Solution 2.

Solution 1 :

  1. Press cmd + comma (,) to open Xcode Preference window
  2. Goto Locations Tab (last one)

Screenshot 1

  1. In Derived Data section check arrow present next to path. Click on that.
  2. This opens a new window with location of Derived data
  3. Delete all the content of this folder. It is created everytime you build project.

Screenshot 2

Solution 2 :

  1. Goto location where your project workspace is present
  2. Right click on workspace and select Show Package content

Screenshot 3

  1. This opens a window with content of workspace. Delete xcuserdata folder. This folder is like cache viz storing details of all you have done with project such as number of debugger set etc.

Screenshot 4

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
5

I believe the Git reset command was made for moments like this. So rather than pointing the finger at Xcode, it's better to have a workflow that acknowledges that things sometimes go wrong. Git reset would take you back to a known good state.

Mark Brownsword
  • 2,287
  • 2
  • 14
  • 23
  • @Confused Git `reset` would take you back to a known good state. – Mark Brownsword Oct 11 '16 at 07:14
  • But how would you know how far back is required? How do you step back progressively? Reset sounds BRUTAL, like... back to original template, or similar. – Confused Oct 11 '16 at 07:24
  • 2
    @Confused Yeah, you are right. What I'm trying to say in my answer is that good work habits help avoid problems like this e.g. when I'm adding a new feature I would create a new branch and do the work, then commit after each successful step, then when I'm satisfied the feature is complete I merge it into the master branch. If I ever have a problem like OP has, I can usually just reset the current uncommited changes and all is good. Call it good practices of a professional software developer! – Mark Brownsword Oct 11 '16 at 07:54
  • 1
    Probably all good points. But I can't help feeling Apple has missed the boat on making Xcode capable of this, and less buggy. – Confused Oct 11 '16 at 07:55
  • Is it possible to setup git (or any other form of backup with time edit storage) once a project is underway in Xcode? You've got me all paranoid. – Confused Oct 11 '16 at 08:20
  • @Confused You can turn on Git in Xcode at any time under the Source Control Menu `Create Working Copy`. This [article](https://www.raywenderlich.com/51351/how-to-use-git-source-control-with-xcode-in-ios-7) is a few years old, but should give some ideas of how to use Git in Xcode. – Mark Brownsword Oct 11 '16 at 09:05
  • Git might be the most ridiculously confusing thing on earth. – Confused Oct 11 '16 at 09:09
  • @Confused I recommend using Git from Terminal, it is actually easier. Just practice on a test project first :) – Mark Brownsword Oct 11 '16 at 09:21
  • I refuse to use the terminal, ever. I'm living in a GUI world. – Confused Oct 11 '16 at 10:03
  • @Confused, there are plenty of git GUIs out there. Some are paid, some are free. You also don't have to use git. You can use another source control like SVN, Perforce, etc. Source control is your friend and if you're not using it, I'd encourage you to find the one that suits you the most and start using it. Even if you are working on your own. There will come a time where it will save you. – Mobile Ben Oct 11 '16 at 19:58
  • You're assuming there are any modifications in the first place. In my instance, there was not. – Relequestual May 31 '17 at 16:18
  • You might have a mismatch between Xcode version and macOS version, especially if you are using beta versions of either. Up or down grading Xcode is always worth a try. – Mark Brownsword May 31 '17 at 20:37
  • "So rather than pointing the finger at Xcode" Oh give me a break. There is no excuse for crashes. What a PoS bit of software. Even if I get my project into a weird state using tools that XCode provides, it should never allow me to get into a state where it chain crashes. That is unacceptable. It literally crashes every time I select a target and I'm unable to work. XCode is garbage. The second an alternative is available I doubt anyone will use it. – Josh Sanders Jul 27 '17 at 18:12
  • @Mark Brownsword by default? Why? Well I guess I should clarify, I'm a C++ engineer so given the freedom I'm allowed with Visual Studio to customize as I see fit and the relative stability of VS, comparatively Xcode is the worst. If I could get our project to link properly with Sublime Text I'd gladly use that instead. – Josh Sanders Aug 01 '17 at 17:22
2

It seemed that a certain sks file was triggering the crash... So the trick to get it working again was to

a. rapidly click to get Xcode to show the project navigator

b. quickly hold ^⌘W , which closed the currently open scene editor that the project kept opening in and subsequently crashing.

c. delete and restore the previous version of the file from time machine.

Now it seems to work.

To avoid Tile Map related crashes ensure you save the tile set before attempting to use it.

As per this question here. Having issues with creating Tile Sets in Xcode 8. Anyone have any success?


On a tangent, blaming Xcode 8 is fair... Xcode 8 is very buggy in terms of Sprite Kit.

It struggles to let me use the new spritekit features in .SKS files created in versions previous to 8.

For instance the tile maps often don't seem to function in these older scenes unless I duplicate the SKS File and delete the old one, then try again. Not to mention Xcode crashes very often.

I'm always one to back up frequently... but it looks like I'm going to need to walk on eggshells with this release. Which is pretty awful.

Community
  • 1
  • 1
Corey F
  • 621
  • 4
  • 14
  • I agree. The fault is with Xcode. It's buggy, slow, crash prone and far outgrown its remit. Scene Editors for things like Particles, SpriteKit, SceneKit, Storyboards and anything else not central to its functionality should be split out and made unique applications. Would improve the performance of both the Editors and ExCode. – Confused Oct 14 '16 at 12:27
1

Well the error is due to some empty array that is being indexed.

UNCAUGHT EXCEPTION (NSRangeException): *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array

Which is here:

3 -[__NSArrayM objectAtIndex:] (in CoreFoundation) 4
-[SKTileSet getCenterTileDefinitionForGroup:withRequiredOutputGroupAdjacency:] (in SpriteKit) 5 -[SKTileMapNode updateTileGroupsAtX:y:] (in SpriteKit) 6 -[SKTileMapNode rebuildTileSprites] (in SpriteKit)
7 -[SKTileMapNode setTileSet:] (in SpriteKit) 8
-[SKEditorTileMapNode assetReference:didUpdateFromDocument:] (in IDESpriteKitParticleEditor)

I get that is most unhelpful. But at least you know it is tile map editor related. This could very well be an Apple bug. But as Mark Brownsword mentioned above, if you have source control, you can go back to your prior version of the file that worked. Then diff with that version versus the current version. If you are not using source control, this unfortunately is an example of why source control is helpful.

Questions like you raise are difficult because you are not clear about actions that lead to this. This isn't to say you are doing something that isn't correct. But it is a difficult diagnosis when limited info is presented.

Mobile Ben
  • 7,121
  • 1
  • 27
  • 43
  • Well yes... but it wasn't easy to pinpoint what actions caused the error. All I know is I had a scene open and was using tile maps and it crashed. That being said, I found the solution thanks to the two answers posted. Mark's solution gave me the idea to try and go backwards... and you got me to realize it was related to a tile map created. As I only created a tile map in a single SKS file, I then realized the solution. So I guess it worked out. – Corey F Oct 11 '16 at 17:02