In this code, when I type GIDSignIn.sharedInstance, for some reason sharedInstance is not a function, which means I can't acces clientID. I cannot find a solution for this anywhere.
import UIKit
import GoogleSignIn
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GIDSignIn.sharedInstance().clientID = "clientID"
return true
}
In latest version of GoogleSignIn SDK. Removed this method.
Now in new follow this link or below code. https://developers.google.com/identity/sign-in/ios/sign-in
@IBAction func clkLoginWithGmail(_ sender: UIButton) {
let signInConfig = GIDConfiguration.init(clientID: "clientID-XYZ")
GIDSignIn.sharedInstance.signIn(with: signInConfig, presenting: self) { user, error in
}
}
There is a change in the dependency.
GIDSignIn.sharedInstance.clientID
Has been changed to:
GIDConfiguration(clientID: "clientID", serverClientID: "serverClientID")
And can be used in your class or AppDelegate.swift
import GoogleSignIn
let gIdConfiguration = GIDConfiguration(clientID: "clientID", serverClientID: "serverClientID")
GIDSignIn.sharedInstance.configuration = gIdConfiguration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With