我正在开始 Swift 并在 macOS 的 Swift 游乐场中使用教程。
所以示例代码是
var str = "Hello, playground"
str
str1
我在 str 1 上没有收到任何红色错误信息。只是控制台崩溃了
Playground execution failed: error: MyPlayground.playground:1:1:
error: use of unresolved identifier 'str1'
str1
^~~~
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x0000000102157360 com.apple.dt.Xcode.PlaygroundStub-macosx`executePlayground
frame #1: 0x000000010215522a com.apple.dt.Xcode.PlaygroundStub-macosx`-[PlaygroundViewBridgeService execute] + 90
如果我更正了代码,那么操场会刷新并显示新数据,它只是不报告错误
如何阻止 Xcode 崩溃并按照文档进行操作?
Xcode 版本 8.3 (8E162) macOS 10.12.4
我已经尝试删除所有 Xcode 文件(包括它在构建过程中创建的文件)并重新安装和使用不同的用户
最佳答案
实际上,游乐场确实显示了 “代码左侧红色标记错误”并且还有一个自动选项来修复错误,就像常规项目一样。
我和你有同样的问题(左边没有出现红色标记)。什么解决了我:
我在 Xcode 8.3.2
更新:同样适用于 Xcode 9.0
关于xcode - Swift Playground 没有显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43241749/