firebase / codelab-friendlychat-ios

Apache License 2.0
69 stars 48 forks source link

Firebase iOS Codelab Swift step 5: GoogleSignIn version / swift code problems #133

Open PDMackinnon opened 3 years ago

PDMackinnon commented 3 years ago

Some errors arising when using latest GoogleSignIn version (5.0.2) So downgraded to version 4.4.0 after some stackoverflow research...

... leads to new build errors with the unsupported lines in Appdelegate.swift :

return GIDSignIn.sharedInstance().handle(url)

Missing arguments for parameters 'sourceApplication', 'annotation' in call

So for everything to work, need to know and specify the version of GoogleSignIn and for all supplied code to consistently work to the specified API

PDMackinnon commented 3 years ago

OK, looked at the finished version and the answer is that the codelab gives out of date code which should be the following (as copied from the final xcode version) :

 override func viewDidLoad() {
    super.viewDidLoad()
    GIDSignIn.sharedInstance()?.presentingViewController = self
    GIDSignIn.sharedInstance()?.restorePreviousSignIn()
    handle = Auth.auth().addStateDidChangeListener() { (auth, user) in
      if user != nil {
        MeasurementHelper.sendLoginEvent()
        self.performSegue(withIdentifier: Constants.Segues.SignInToFp, sender: nil)
      }
    }
  }
samtstern commented 3 years ago

@PDMackinnon thanks for reporting this. @morganchen12 can you submit the fix?