Xcode playground gets stuck on 'Running playground' or 'Launching simulator' and won't run the code, what to do?

前端 未结 22 720
情歌与酒
情歌与酒 2020-12-22 16:03

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 \'Running playground\' or \'Launching simulator

相关标签:
22条回答
  • 2020-12-22 16:12

    Firstly, delete the inbuilt comment line.

    Then, even if you put a first line comment back in, it still works.

    0 讨论(0)
  • 2020-12-22 16:14

    I have cancelled the comment on the first line. It solved for me. Make sure to try it after you have closed and relaunched Xcode and force quit com.apple.coresimulator from Activity Monitor

    0 讨论(0)
  • 2020-12-22 16:14

    Check for iCloud storage plan!

    If you do have one, it constantly syncs the entire computer which includes Desktop and Document folders. Instead try creating a "Local Files" folder in your Home folder(command+shift+h) and keep your Playground projects there, where it doesn't sync to iCloud.

    This worked for me.I hope this works for you as well! :)

    0 讨论(0)
  • 2020-12-22 16:15

    I had the same problem, all that I did is to open Assistance editor and everything works fine with me even when I closed the Assistance editor! Don't ask why it was trial and error. Hope this will help you

    0 讨论(0)
  • 2020-12-22 16:15

    I was facing the same issue but after googling and experimenting a bit, I found out that one must always import UIKit before importing any other libs.

    0 讨论(0)
  • 2020-12-22 16:18

    In my experience, you should:

    1. Prevent Swift playground refresh, by holding: the ► arrow at the bottom left part of the Playground and selecting "Manually Run"
    2. Quit Xcode
    3. Restart Xcode

    It works very well.

    0 讨论(0)
提交回复
热议问题