Ray*_*ach 2 ios google-signin swift3
我正在使用Swift 3并尝试使用本教程进行 Google登录
使用以下内容创建了桥接头文件:
#import <Google/SignIn.h>
Run Code Online (Sandbox Code Playgroud)
然而,当我去实现App Delegate时,我收到此错误:
*Use of undeclared type GIDSignInDelegate*
Run Code Online (Sandbox Code Playgroud)
我可能会缺少什么?
请不要导入任何类似google的框架。如果已在头桥文件中正确添加Xcode,Xcode将自动访问所需的模块。
并使用以下方法删除您的错误。
public func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if (error == nil) {
// 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
// ...
} else {
print("\(error.localizedDescription)")
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2059 次 |
| 最近记录: |