NSScanner字符串始终为nil(EXC_BAD_INSTRUCTION(代码= EXC_i386_INVOP,子代码= 0x0))

时间:2015-04-19 17:00:42

标签: ios string swift nsscanner

使用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

0 个答案:

没有答案