每次我为了测试一些代码而创建一个新游乐场时,Xcode都会卡住并且不会运行代码。它只是在屏幕顶部显示“Running playground”或“Launching simulator”语句,加载图标很可能在它旁边旋转,但没有任何反应。有时这会无限期地继续,有时Xcode会停止并将其打印到控制台:
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
我在macOS Sierra 10.12上运行Xcode 8.0(8A218a)。
硬件: MacBook Pro(2012年中期“13”) 2,5 GHz Intel Core i5 4 GB 1600 MHz Ram DDR3
我环顾四周,但至少这些线程都没有提供答案: https://forums.developer.apple.com/thread/5902 https://github.com/jas/playground/issues/9
我已经尝试过的事情没有成功:
您对如何解决这个问题有任何想法吗?我是编程新手,急切地想学习Swift,但是Xcode几乎不可能......
提前谢谢,干杯。
确保在最终杀死活动监视器中的com.apple.CoreSimulator.CoreSimulatorService进程之前,先杀死活动监视器中的xcode。我尝试多次杀死该进程并且我意识到如果xcode仍然在后台活动中运行,那么即使你刚杀死它,com.apple.CoreSimulator.CoreSimulatorService进程也会再次弹出。
运行一段时间后你会看到错误信息,然后你去查看>调试区>激活控制台,然后再次播放为我工作
我正在使用XCode 10.2并且遇到了同样的问题。所以一般只使用Online Swift Playground
这符合我的目的! :-)
我面临同样的问题,但在谷歌搜索和实验后,我发现在导入任何其他库之前必须始终import UIKit
。
检查iCloud存储计划!
如果你有一个,它会不断同步整个计算机,包括桌面和文档文件夹。而是尝试在您的主文件夹中创建“本地文件”文件夹(命令+ shift + h)并将Playground项目保留在那里,它不会同步到iCloud。
这对我有用。我希望这也适合你! :)
最后一个适合我的提示:确保没有iOS模拟器正在运行。他们互相冲突。
我尝试了以下内容,它对我有用:
在我的情况下,Xcode 8.3.2,当我尝试以下步骤时,它工作:
即使在Xcode关闭后,Buggy Simulator的主要流程仍然有效。所以这是步骤:
com.apple.CoreSimulator.CoreSimulatorService
进程;根据我的经验,你应该:
它工作得很好。
我已经取消了第一行的评论。它为我解决了。在关闭并重新启动Xcode并强制退出活动监视器中的com.apple.coresimulator之后,请确保尝试使用它
添加导入PlaygroundSupport为我解决了问题:)
我遇到了同样的问题,我所做的就是打开协助编辑器,即使我关闭了协助编辑器,一切正常!不要问为什么它是反复试验。希望对你有帮助