swift:解析数据格式 The process has been returned to the state before expression evaluation.

guard let rs = userInfo["result"]?["isSuccess"] else {
return
}
if rs as? NSNumber == 1 || rs as? String == "1" {
}

可选链不会报错,如果转换类型不正确就会报错
if userInfo["result"]?["isSuccess"] as! Int == 1{}
if userInfo["result"]?["isSuccess"] as! NSInteger == 1{}
这里转不了 Int 所以报错
error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x10341b38c).
The process has been returned to the state before expression evaluation.

字典[String : AnyObject]的某个字段Any-->AnyObject -->1.NSNumber,2.String
暂时就想到这么多,别的类型的有可能也会出现.

这里是因为后台不同接口的返回数据的类型不一样,导致一个VC里面两个接口返回值用一种类型去转换解析出现想反的结果,一个正常,一个崩溃.

你可能感兴趣的:(swift:解析数据格式 The process has been returned to the state before expression evaluation.)