(iOS) Playgrounds in xCode 9 Don't Run

Created a new iOS playground in xCode 9 beta but it never actually runs. The little spinner at the top just keeps spinning and saying "Running MyPlayground..", but there's no output.


Trying with a new Mac playground works fine.

Accepted Reply

Didn’t work for me, unfortunately. Can’t get playgrounds to render any live view.

Replies

I've gotten it to work, but only on macOS 10.13 beta. I had the same experience you did on 10.12.

Is this only solution at the moment? One is installing Xcode 9 beta and totally different thing installing macOS beta.

I had the same problem. I installed High Sierra but it didn't solve the problem. It seems to be a conflict between the files created by Xcode 8 and Xcode 9 for the simulator. My solution was to go to the folder where the files are created and erase all the folders inside. The folder is at Users/yourname/Library/Developer/XCPGDevices. I erased everything inside this last folder and now Playground in Xcode 9 works.


JD

This worked for me thank you.

Didn’t work for me, unfortunately. Can’t get playgrounds to render any live view.

Didn't work for me either.

To be honest I am actually surprised this problem still persists in Xcode 9. Once you create a file and it encounters erros while typing the code, sometimes it breaks the live run. Usually I restarted xCode and it's resolved. In Xcode 9 it's not, I have to create a new file, and copy my code into it and the new file will work.

no solutions here above my reply works for me (period)

the running process occupies the CPU 100%, check your 'Activity Monitor'

Does anyone have a solution to this? I tried erasing the folder Users/yourname/Library/Developer/XCPGDevices. but it does not solve the problem

Xcode 9 is broken and there's nothing that we can do until Apple admits the problem (unlikely at this point since we're now at version 9.4 and the problems have existed since 9.0). However you can still use it, just not in live view. Do the following:


1. DO clear that subdirectory (Users/yourname/Library/Developer/XCPGDevices) as mentioned above (this will give temporary relief).

2. Program your snippet

3. At some point Xcode WILL detect some error in your code and stop rendering the live view.

4. Just continue on with your programming until you're done (you're not really writing a full implementation are you?)

5. Wait a moment, perhaps 15-20 seconds to allow Xcode to save everything.

6. Close Xcode completely and wait about a minute.

7. Restart Xcode and choose your playground. It will run the simulator and then accurately run your code.

8. Fix errors, then repeat steps 5-8 until eveyrthing is worked out.

The play button has a disclosure triangle, click and hold and choose option Automatically Run. The play button should turn blue when this is set, otherwise it is black.

I had the same problem with Xcode 10 and this actually helped. I quit the Xcode and followed the instruction to remove everything inside Users/yourname/Library/Developer/XCPGDevices. Instead of deleting the items, I just moved them to the Desktop. Then I restarted the Playground but nothing changed. Still not working. Then I quit the Xcode and deleted the new file created in the folder and moved the original files I moved to the Desktop back to the folder. Then I restarted the Playground and it worked!