繁体   English   中英

iOS SwiftUI - Google 登录错误:调用中的额外参数“回调”

[英]iOS SwiftUI - Google Sign-In error: Extra argument 'callback' in call

我得到了这个代码:

func signIn(){

   guard let presentingViewController = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.windows.first?.rootViewController else {return}

    let signInConfig = GIDConfiguration.init(clientID: "xxxxx")
    GIDSignIn.sharedInstance.signIn(
        with: signInConfig,
        presenting: presentingViewController,
        callback: { user, error in
            if let error = error {
                self.errorMessage = "error: \(error.localizedDescription)"
            }
            self.checkStatus()
        }
    )
}

我收到错误“调用中的额外参数‘回调’”

在支架上

callback: { user, error in

请帮忙

你可以试试

GIDSignIn.sharedInstance.signIn(
    with: signInConfig,
    presenting: presentingViewController) { user, error in
      if let error = error {
            self.errorMessage = "error: \(error.localizedDescription)"
      }
      self.checkStatus()
    } 

请参阅文档4 节。添加 Google 登录按钮

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM