我做了一个简单的程序来测试 Swift 整数文字。我还没有深入研究 Swift。我从网页复制了代码并重命名了变量。我得到:
Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x0). The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
import UIKit
let desimaali = 42
let binaari = 0b101010
let oktaali = 0o52
let heksa = 0x2A
我曾尝试用普通空格手动替换所有空白字符,以防有特殊的隐藏字符,但情况似乎并非如此。可能是什么问题呢? Swift Playgrounds 中的错误? (OS X 10.11.6 和 Xcode 8.2.1。)
最佳答案
我从这里找到了解决方案:Xcode 8 error when start MyPlayground. How to fix it?
在末尾添加更多行并删除这些行:
I had the same issue and tried adding an additional line to the default playground text (the code that a new playground creates by default). Same error but then I went to the end of the file, backspaced over everything up to the end of the line with var string = "Hello, playground" and hit Enter and the playground worked! Somehow forcing XCode to reread the file without a bunch of trailing blank lines fixed it? Weird.
关于swift - 执行被中断,原因: EXC_BAD_ACCESS - Swift Literals,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45223577/