gpt4 book ai didi

ios - 实现 iOS 版 Google 登录 (Swift 2.0)

转载 作者:行者123 更新时间:2023-11-30 13:36:06 28 4
gpt4 key购买 nike

我读过一些关于此的主题,但没有一个主题解决了问题。我正在尝试按照 Google 开发人员 portal 提到的步骤在 iOS 上实现 Google Sign in .

当我在代码中添加 Google 开发者门户中提到的以下 2 个委托(delegate)方法时,我无法编译源代码。

func application(application: UIApplication,
openURL url: NSURL,options: [String: AnyObject]) -> Bool {
return GIDSignIn.sharedInstance().handleURL(url,
sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey],
annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
}

func application(application: UIApplication,
openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
var options: [String: AnyObject] = [UIApplicationOpenURLOptionsSourceApplicationKey: sourceApplication,
UIApplicationOpenURLOptionsAnnotationKey: annotation]
return GIDSignIn.sharedInstance().handleURL(url,
sourceApplication: sourceApplication,
annotation: annotation)
}

这是错误屏幕截图:

enter image description here

最佳答案

试试这个

 func application(application: UIApplication,
openURL url: NSURL, options: [String: AnyObject]) -> Bool
{
return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
}


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

示例请参见this

关于ios - 实现 iOS 版 Google 登录 (Swift 2.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36053028/

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