I'm trying to authenticate with Firebase using their Google Accounts by integrating Google Sign-In into app.
Using:
I have implemented the two methods of GIDSignInDelegate
in AppDelegate
// Sign-in flow has finished and was succcesful if error is nil:
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!){
if let error = error {
print(error.localizedDescription)
return
}
guard let authentication = user.authentication else { return }
let credential = FIRGoogleAuthProvider.credential(withIDToken: authentication.idToken,
accessToken: authentication.accessToken)
// Finished disconnecting user from the app succesfully if error is nil:
func sign(_ signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!,
withError error: Error!) {
// Perform any operations when the user disconnects from app here.
// ...
}
yet I am still faced with the compile issue:
AppDelegate does not conform to protocol 'GIDSignInDelegate'
It looks like you defined the methods of that protocol outside of the AppDelegate
class, so they are just global functions, not methods.
You need to move them inside the }
that closes AppDelegate
(just above the first protocol method).
Tip : if you select all of the code in that file and press
Ctrl+I
Xcode will reindent your code which may make it easier to see what's going wrong.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.