swift - 我收到错误消息 "expected ' )' in expression list"连接到@IBAction func createaccountButton

标签 swift xcode ibaction

    @IBAction func createaccountButton(sender: AnyObject) { !Expected ')' in expression list
    FIRAuth.auth()?.createUserWithEmail(emailField.text!, password: passwordField.text!, completion: { (user, error) in
        if error == nil {
            print("User Created")

    if (FIRAuth.auth()?.currentUser) != nil
    {
        self.myaccountButton.alpha = 1.0
    }
    else
    {
        self.myaccountButton.alpha = 0.0
        self.welcomeLabel.text = ""
                }
            }
        }
    )}
}

我不知道把 ) 放在所说的表达式中请帮助我尝试了一切

最佳答案

对于遇到此问题的人来说,这是因为您的代码中某处缺少一个右括号)。检查您遇到问题的行或之前的行。这是因为有一个左括号(用于参数但没有右括号)来关闭它。确保您的右括号与参数的左括号匹配。

对于这个特定的代码,这是因为你有一个左括号,没有右括号来结束参数:

(emailField.text!, password: passwordField.text!, completion: { (user, error) in 

您缺少上面的右括号。

出于某种原因,您在底部还有一个右括号。

        self.welcomeLabel.text = ""
                }
            }
        }
    )} //right here is an obscure closed parenthesis
}

关于swift - 我收到错误消息 "expected ' )' in expression list"连接到@IBAction func createaccountButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38579623/

相关文章:

ios - 上下文类型 'NSObject' 不能与字典文字一起使用

ios - SceneKit - 使用基于方向的平移手势旋转 SCNNode

ios - 无法使用核心数据持久删除记录

uitableview - 自定义 UITableViewCell 和 IBAction

swift - ios8/swift : Buttons inside UICollectionView Cell?

ios - SWIFT 单击按钮应用程序崩溃

ios - 不能在不可变值部分使用可变成员是一个 let 常量 (swift3)

ios - NSUserDefaults 加载问题

xcode - 生成 Core Data 子类后如何修复 Xcode 10 错误 'Multiple commands produce..'

iphone - ARC 下 -viewDidUnload 中的弱属性和强属性