Xcode游乐场卡在'Running playground'或'启动模拟器'上并且不会运行代码,该怎么办? [英] Xcode playground gets stuck on 'Running playground' or 'Launching simulator' and won't run the code, what to do?

查看:589
本文介绍了Xcode游乐场卡在'Running playground'或'启动模拟器'上并且不会运行代码,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我为了测试一些代码而创建一个新游乐场时,Xcode都会卡住并且不会运行代码。它只是在屏幕顶部显示Running playground或Launching simulator语句,加载图标很可能在它旁边旋转,但没有任何反应。有时这会无限期地继续,有时Xcode会停止并将其打印到控制台:

 游乐场执行失败:错误:无法查找符号: 
__swift_FORCE_LOAD _ $ _ swiftCoreImage
__swift_FORCE_LOAD _ $ _ swiftFoundation
_playground_log_hidden
_playground_logger_initialize
_playground_log_postprint

thread#1:tid = 0xc0cd0,0x000000010ea7c3c0 MyPlayground`executePlayground, queue ='com.apple.main-thread',stop reason = breakpoint 1.2

frame#0:0x000000010ea7c3c0 MyPlayground`executePlayground
frame#1:0x000000010ea7b9c0 MyPlayground`__37- [XC​​PAppDelegate enqueueRunLoopBlock] _block_invoke + 32
frame#2:0x000000010f59625c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame#3:0x000000010f57b304 CoreFoundation`__CFRunLoopDoBlocks + 356
frame#4:0x000000010f57aa75 CoreFoundation`__CFRunLoopRun + 901
frame #5:0x000000010f57a494 CoreFoundation`CFRunLoopRunSp ecific + 420
frame#6:0x0000000114985a6f GraphicsServices`GSEventRunModal + 161
frame#7:0x0000000110124f34 UIKit`UIApplicationMain + 159
frame#8:0x000000010ea7b6e9 MyPlayground`main + 201
frame #9:0x0000000112ad268d libdyld.dylib`start + 1
frame#10:0x0000000112ad268d libdyld.dylib`start + 1

我在macOS Sierra 10.12上运行Xcode 8.0(8A218a)。



硬件

MacBook Pro(132012年中期)

2,5 GHz Intel Core i5

4 GB 1600 MHz Ram DDR3



我环顾四周但这些线程中至少都没有提供答案:


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' statement at the top of the screen with the loading icon promisingly spinning next to it but nothing happens. Sometimes this continues indefinitely and sometimes Xcode halts and prints this to console :

Playground execution failed: error: Couldn't lookup symbols:
__swift_FORCE_LOAD_$_swiftCoreImage 
__swift_FORCE_LOAD_$_swiftFoundation 
_playground_log_hidden 
_playground_logger_initialize 
_playground_log_postprint 

thread #1: tid = 0xc0cd0, 0x000000010ea7c3c0 MyPlayground`executePlayground, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2

frame #0: 0x000000010ea7c3c0 MyPlayground`executePlayground
frame #1: 0x000000010ea7b9c0 MyPlayground`__37-[XCPAppDelegate enqueueRunLoopBlock]_block_invoke + 32 
frame #2: 0x000000010f59625c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #3: 0x000000010f57b304 CoreFoundation`__CFRunLoopDoBlocks + 356
frame #4: 0x000000010f57aa75 CoreFoundation`__CFRunLoopRun + 901
frame #5: 0x000000010f57a494 CoreFoundation`CFRunLoopRunSpecific + 420
frame #6: 0x0000000114985a6f GraphicsServices`GSEventRunModal + 161
frame #7: 0x0000000110124f34 UIKit`UIApplicationMain + 159
frame #8: 0x000000010ea7b6e9 MyPlayground`main + 201
frame #9: 0x0000000112ad268d libdyld.dylib`start + 1
frame #10: 0x0000000112ad268d libdyld.dylib`start + 1

I am running Xcode 8.0 (8A218a) on macOS Sierra 10.12.

Hardware:
MacBook Pro (13" Mid-2012)
2,5 GHz Intel Core i5
4 GB 1600 MHz Ram DDR3

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

Do you have any ideas on how to solve this problem? I am new to programming and eagerly trying to learn Swift but Xcode is making it practically impossible...

Thank you in advance, cheers.

解决方案

Ans. Switch to macOS platform

When you create a Playground, by default it select iOS platform and automatically imports UIKit. It's the UIKit which crashes and stuck all the time. If your (practice) code does not use UIKit then you can switch to MacOS platform. As major (not exact though) difference between iOS and macOS is in APPKit and UIKit.

In the upper right corner of your Xcode Playground, click on show/hide Utilities--> file inspector --> Playground Setting--> Platform--> macOS

See screenShot below:

这篇关于Xcode游乐场卡在'Running playground'或'启动模拟器'上并且不会运行代码,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆