gpt4 book ai didi

ios - Swift - 谷歌身份验证

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:11:37 27 4
gpt4 key购买 nike

我正在使用 Swift 3 并尝试使用此 tutorial 进行 Google 登录

创建了一个桥接头文件:

#import <Google/SignIn.h>

我的build设置引用了正确的头文件 enter image description here

然而,当我去实现 App Delegate 时,我收到了这个错误:

*Use of undeclared type GIDSignInDelegate*

enter image description here

我可能遗漏了什么?

最佳答案

请不要导入任何框架,如谷歌。如果您在 header 桥接文件中正确添加,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)")
}
}

关于ios - Swift - 谷歌身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42149705/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com