To play or not to play(ground) in Xcode?

I’ve experienced a very weird playgrounds bug in Xcode last week that kept me out of commission for two days until I finally managed to sort it out.

It all started on Tuesday when Apple launched El Capitan 10.11.2 and Xcode 7.2 final releases. I rushed to download them because I always want to have the latest version of all the tools I work with. I updated El Capitan first and there were no problems as usual. Then I downloaded Xcode – it took five long hours (this release is really huge – 4.5 GB – and I don’t have a very good Internet connection here). I installed it, opened a playground and bummer – got the following error message:

Playground execution terminated because the playground process exited unexpectedly.

I knew this was a good old Xcode 6 error that Xcode 7 had fixed in the meantime so I restarted Xcode but it didn’t go away. I restarted the Mac – same thing. So I started digging in the trenches for possible solutions and fixes. The first thing I tried was this Stack Overflow post:

I installed the Xcode command line tools in Terminal as the post suggested but the problem was still there. So I did some more research and discovered that the error appeared only for playgrounds which run with iOS – it worked perfectly if I switched to OS X or tvOS. Now I was even more puzzled. I discovered that it may have something to do with the iOS simulator so I reset all simulators and added them back again – no change.

So I decided to make a fresh and clean install of Xcode (the previous install was an update from Xcode 7.1.1). I deleted everything and downloaded it all over again – another five long hours of waiting and praying that everything will be OK after all. I installed it back again – and the problem was still there. Well, at least I knew now that it wasn’t from a previous bad or corrupted install after all for sure and for good indeed.

I could have gone even further – make a backup and fresh and clean install of El Capitan that would surely have sorted everything out, but I wanted to understand what the problem really was under the hood and localise it first. So I decided to take out the big guns and study the logs with Console Activity. First of all, I cleared the cache from the Derived Data folder. Then I noticed that the playground was using the iOS 9.1 runtime environment instead of iOS 9.2 when running. I checked the Core Simulator Profiles and Runtimes – all of them were there except for iOS 9.2. This was really weird since the iOS 9.2 simulators all worked in Xcode just fine.

I was becoming more and more frustrated, irritated, annoyed and didn’t understand anything anymore. I decided to try out one last thing before starting to back up and reinstall the operating system. I logged on my guest account, launched the playground there and surprise – it worked. I started laughing – I was so tired of everything that I didn’t know whether to laugh or cry instead. I couldn’t believe it was working there after all.

It turns out that there was some problem with my administrator account which was causing the error – not sure what was it exactly though, but should have tried that in the first place before attempting to do anything else. So I created another administrator account, shared data between accounts with the Shared Folder and I was finally good to go all over again.

I’ve lost two days because of this stupid bug but I’ve learned a couple of valuable things from the whole experience:

  1. Don’t panic – you won’t solve anything by doing that.
  2. Try the most obvious solution first, not last.
  3. Don’t skip anything and assume nothing – stay hungry, stay foolish.
  4. If nothing else works – just reinstall.
  5. It’s OK to research – as long as you don’t take your PhD in it.

If you had any similar experiences or issues I would love to hear them, so please share your comments below! 🙂

Posted in Articles

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Enter your email address to receive notifications of new posts by email.

Simple Programmer
%d bloggers like this: