if(Int(textfield.text!)! != nil) { //value of type 'Int' can never be nil, comparison isn't allowed.
//Rest of the code
}
一切工作正常,但昨天我更新了Xcode,然后收到此错误。请帮忙。
要进行检查,nil
只需删除结尾的感叹号即可,以使Int
初始化程序的结果保持为可选。
if Int(textfield.text!) != nil {
//Rest of the code
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句