ios - "There is no registered handler for URL scheme com-google-gidconsent"使用 GIDSignIn 登录时出错

标签 ios swift google-signin

我已经在 sdk 中手动集成了 google 登录(不使用 cocoapods)并且构建正常,但是当我运行该项目时,我总是在登录后遇到此错误:

2015-09-07 15:44:14.071 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com-google-gidconsent-google
2015-09-07 15:44:14.071 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com-google-gidconsent-youtube
2015-09-07 15:44:14.072 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com-google-gidconsent
2015-09-07 15:44:14.072 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com.google.gppconsent.2.4.1
2015-09-07 15:44:14.072 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com.google.gppconsent.2.4.0

这就是我使用 sdk 的方式。

首先,我按照 https://developers.google.com/identity/sign-in/ios/sign-in?ver=swift 中的所有步骤进行操作.

代码:
AppDelegate.swift

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {  
    // google
    // Initialize sign in
    GIDSignIn.sharedInstance().clientID = "<client id>"
    GIDSignIn.sharedInstance().delegate = self

    return true
}

func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {

    if error == nil {
        let userID = user.userID
        let idToken = user.authentication.idToken
        let name = user.profile.name
        let email = user.profile.email

        print(userID, idToken, name, email)
    } else {
        print(error.localizedDescription)
    }
}

func signIn(signIn: GIDSignIn!, didDisconnectWithUser user: GIDGoogleUser!, withError error: NSError!) {

}

ViewController.swift

 override func viewDidLoad() {
        super.viewDidLoad()

        // google plus
        //GIDSignIn.sharedInstance().clientID = clientID
        GIDSignIn.sharedInstance().uiDelegate = self
        GIDSignIn.sharedInstance().signIn()
}  

可能是什么问题?我使用的是 SDK 版本 2.2.0

最佳答案

您的实现没有问题。所有这些警告都意味着每个 URL 方案引用的应用程序未安装在设备上。

如果您在模拟器上进行测试,您会一直遇到这些错误。但是,如果您在设备上进行测试,您可以验证如果安装了相应的应用程序,错误就会消失。

例如,如果您的设备上有 Youtube 应用,您将不会看到以下行:

2015-09-07 15:44:14.071 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com-google-gidconsent-youtube

关于ios - "There is no registered handler for URL scheme com-google-gidconsent"使用 GIDSignIn 登录时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32439238/

相关文章:

ios - 如何确认我们的代码没有在 iOS 发布二进制文件中调用 NSAssert

ios - 文档从未出现在 "Recent"选项卡中

ios - 如何在 SwiftUI 中制作增量为 0.5 的 5 星评论小部件

ios - 我应该从 UIViewController 中的 firebase 加载数据到哪里

ios - (Swift) 以编程方式将 UIButton 约束到角落

javascript - HTTP :403 forbidden error when trying to load img src with google profile pic

java - 如何正确实例化 GoogleIdTokenVerifier/.setAudience() 做什么?

ios - Xcode 11 > 安装(刷新)Provisioning Profiles 崩溃

asp.net - AuthenticationProperties.RedirectUri 未在 Challenge() 中传递给 Google

objective-c - 如何对 NSArray 进行二分查找?