gpt4 book ai didi

ios - 按谷歌登录按钮时没有任何反应

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

我已经使用 pods 配置了适用于 ios 的 Google SDK。我添加了一个 uiview 作为登录按钮(将类设置为 GIDSignInButton)。并添加了连接。但是当我按下按钮时,它不会显示任何东西。它不调用委托(delegate)方法。我在网上搜索但没有找到。请指导我解决这个问题。

谢谢

这是我的 View Controller

class Login: UIViewController , GIDSignInUIDelegate{

@IBOutlet var googleLogIn: GIDSignInButton!
override func viewDidLoad() {
super.viewDidLoad()

GIDSignIn.sharedInstance().uiDelegate = self

// Uncomment to automatically sign in the user.
// GIDSignIn.sharedInstance().signInSilently()

// TODO(developer) Configure the sign-in button look/feel
// ...
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
withError error: NSError!) {
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 name = user.profile.name
let email = user.profile.email
// ...
} else {
print("\(error.localizedDescription)")
}
}

func signIn(signIn: GIDSignIn!, didDisconnectWithUser user:GIDGoogleUser!,
withError error: NSError!) {
// Perform any operations when the user disconnects from app here.
// ...
}

这是我的应用委托(delegate)

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.


FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
//Optionally add to ensure your credentials are valid:

var configureError: NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")

GIDSignIn.sharedInstance().delegate = self


return true
}


func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return GIDSignIn.sharedInstance().handleURL(url,
sourceApplication: sourceApplication,
annotation: annotation)
//FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
withError error: NSError!) {
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 name = user.profile.name
let email = user.profile.email
// [START_EXCLUDE]
NSNotificationCenter.defaultCenter().postNotificationName(
"ToggleAuthUINotification",
object: nil,
userInfo: ["statusText": "Signed in user:\n\(name)"])
// [END_EXCLUDE]
} else {
print("\(error.localizedDescription)")
// [START_EXCLUDE silent]
NSNotificationCenter.defaultCenter().postNotificationName(
"ToggleAuthUINotification", object: nil, userInfo: nil)
// [END_EXCLUDE]
}
}

func signIn(signIn: GIDSignIn!, didDisconnectWithUser user:GIDGoogleUser!,
withError error: NSError!) {
// Perform any operations when the user disconnects from app here.
// [START_EXCLUDE]
NSNotificationCenter.defaultCenter().postNotificationName(
"ToggleAuthUINotification",
object: nil,
userInfo: ["statusText": "User has disconnected."])
// [END_EXCLUDE]
}

最佳答案

不知道有没有人遇到这个问题。我知道这可能不是你的情况,但对于其他人来说,我也面临同样的问题,但就我而言,我在容器 View 中添加了 Google 登录按钮,该按钮具有用于关闭键盘的 Tap 手势,因此当我点击 Google Sign 时-在 ,它以前不起作用。从我的角度来看只是有点愚蠢:)

关于ios - 按谷歌登录按钮时没有任何反应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33666262/

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