PHP中文网2017-04-17 14:55:01
Looking at this error description, the questioner probably forcibly unpacked the optional variables, right? Forced unpacking must ensure that the variable value is not empty, otherwise an error will be reported. The insurance method is as follows:
var a:Int?
if let a1 = a {
//如果a非空,就会将a的值赋值给a1,然后直接用a1就行了
}