使用NSScanner
时,代码如下:
var s: String?
var b: NSString?
let scn = NSScanner(string: "andgostring")
scn.scanUpToString("go", intoString: &b)
b = NSString(string:"http")
s = b // <--- Crashes here
...与
崩溃EXC_BAD_INSTRUCTION(代码= EXC_i386_INVOP,子码=为0x0