【发布时间】:2015-06-21 23:34:04
【问题描述】:
可选类型 'Bool' 不能用作布尔值;改为测试 '!=nil'
我在第一次 if 时遇到错误,通过替换 if 条件 (after),第二个 if 条件 从未运行。任何想法?
之前:
if(userEmail?.isEmpty || userPassword?.isEmpty || userRepeatPassword?.isEmpty){
displayMyAlertMessage("All fields are required")
return
}
if(userPassword != userRepeatPassword){
displayMyAlertMessage("Passwords do not match.")
}
之后:
if(userEmail != nil || userPassword != nil || userRepeatPassword != nil){
displayMyAlertMessage("All fields are required")
return
}
if(userPassword != userRepeatPassword){
displayMyAlertMessage("Passwords do not match.")
}
【问题讨论】: