0

I am trying to integrate the gmailsignup to get the user details.but unfortunately app getting crashed and in console I am getting like "reason: 'Your app is missing support for the following URL schemes: com.googleusercontent.apps.184175093548-lsh99pp3c7hcglf12e2udcm0vcinjvd9'"If any one help me to fix it would be great.Thanks in advance.

//AppDelegate class, which I have written additionally.
import UIKit
import GoogleSignIn

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {

    var window: UIWindow?
    func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
        if let error = error {
            print("\(error.localizedDescription)")
        } else {
            // Perform any operations on signed in user here.
            let userId = user.userID                  // For client-side use only!
            let idToken = user.authentication.idToken // Safe to send to the server
            let fullName = user.profile.name
            let givenName = user.profile.givenName
            let familyName = user.profile.familyName
            let email = user.profile.email
            // ...
        }
    }

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: \[UIApplication.LaunchOptionsKey: Any\]?) -> Bool {

        GIDSignIn.sharedInstance().clientID = "184175093548-lsh99pp3c7hcglf12e2udcm0vcinjvd9.apps.googleusercontent.com"
        GIDSignIn.sharedInstance().delegate = self
        let navigation = UINavigationController()
        let mainView = gmail(nibName: "gmail", bundle: nil) //ViewController = Name of your controller
        navigation.viewControllers = \[mainView\]
        self.window!.rootViewController = navigation
        self.window?.makeKeyAndVisible()
        // Override point for customization after application launch.
        return true

    }
    func application(_ app: UIApplication, open url: URL, options: \[UIApplication.OpenURLOptionsKey : Any\] = \[:\]) -> Bool {
        return GIDSignIn.sharedInstance().handle(url as URL?,
                                                 sourceApplication: options\[UIApplication.OpenURLOptionsKey.sourceApplication\] as? String,
                                                 annotation: options\[UIApplication.OpenURLOptionsKey.annotation\])
    }

//View controller class


import UIKit
import GoogleSignIn


class gmail: UIViewController,GIDSignInUIDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        var error: Error?



        let signinbtn = GIDSignInButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50))
        // Do any additional setup after loading the view.
        GIDSignIn.sharedInstance().uiDelegate=self
        signinbtn.center = view.center
        view.addSubview(signinbtn)
    }

    func signInWillDispatch(signIn: GIDSignIn!, error: NSError!) {
       // myActivityIndicator.stopAnimating()
    }


}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Navya
  • 39
  • 7

0 Answers0