Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialemilosvald
9,701 PointsXcode playground gets stuck on 'running' and won't run the code, what to do?
Hi guys,
I have been following the Swift track for a while now but Xcode is messing with my progress. Every time I create a new playground in order to test some code, Xcode gets stuck and won't run the code. It simply presents a promising 'running' statement at the top of the screen but nothing happens no matter how long I wait.
I am running Xcode 8.0 on macOS Sierra 10.12. Hardware: MacBook Pro (13" Mid-2012) 2,5 GHz Intel Core i5 4 GB 1600 MHz Ram DDR3
Any ideas on solving? I have looked around but at least neither of these threads have provided an answer: https://forums.developer.apple.com/thread/5902 https://github.com/jas/playground/issues/9
Things I have already tried with zero success:
- Restarting Xcode
- Reinstalling Xcode (downgraded to 7.3 but since that didn't help I upgraded back to 8.0)
- Restarting the machine
- Creating a new playground
Thank you in advance, cheers.
6 Answers
David Lin
35,864 PointsPlaygrounds are notoriously slow, because it's running in real-time and responding to every change. If you have commands that are computationally heavy (e.g. processing through huge arrays, etc.) that will bog things down significantly. Also, I've noticed it helps speed things up in the Playground to create classes/structs/enums/etc in separate files in the file manager to the left, just as you would a real project.
David Lin
35,864 PointsHmm, exactly what statement are you trying to print? Seems like your playground isn't happy with it. You might try re-installing XCode just to see if that helps. Or, can you post your playground at some file-sharing site or GitHub and provide the link here? I can help test it with you.
emilosvald
9,701 PointsThanks again David for your effort and sorry I have kept you waiting. I have reinstalled Xcode multiple times without any luck and even tried an older version of the software (see the original post). The content of the playground in which I received the error message posted above was nothing else but:
print("Some text")
The Duka
750 PointsThe same problem happens with me when testing a very simple function, I have a MBPr15" (Late 2013) with Sierra 10.12.6
Matthew Jeng
9,242 PointsI'm also encountering this problem on very simple code. If anyone has found a solution please do tell.
emilosvald
9,701 PointsThe discussion goes on in here: https://stackoverflow.com/questions/39978092/xcode-playground-gets-stuck-on-running-playground-or-launching-simulator-and
emilosvald
9,701 Pointsemilosvald
9,701 PointsThank you for your quick reply, David. The problem is that in my case Xcode's behaviour is not actually caused by complex code. The forementioned freezing happens even if I am simply trying to print a single statement to the console. The problem must thus be somewhere else.
Yesterday I left the playground running and after some 20 minutes Xcode printed this to the console:
Does anyone have an idea what this implies?