I follow the guideline of firebase but when I enter code for client ID in AppDelegate
, it not accept. Also it not accept the GIDSignInDelegate
method.
CodePudding user response:
Since 6.0.0
GoogleSignIn doesn't have a delegate anymore, they've switched to completions(probably to easily support new swift concurrency).
Check out migration guide.
You can use it like this now, in your view controller:
GIDSignIn.sharedInstance.signIn(
with: "clientId",
presenting: self // your view controller
) { user, error in
if let token = user?.authentication.idToken {
completionHandler(token, nil)
return
}
guard let error = error as? GIDSignInError else {
fatalError("No token and no GIDSignInError: \(String(describing: error))")
}
completionHandler(nil, error)
}
In your AppDelegate
you need this(just like before):
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return GIDSignIn.sharedInstance.handle(openURL)
}