小编典典

使用GIDSignIn签名时出现“ URL方案com-google-gidconsent没有注册处理程序”错误

swift

我已经手动将google sign in sdk集成到sdk中(不能与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


阅读 175

收藏
2020-07-07

共1个答案

小编典典

您的实现没有问题。所有这些警告意味着未在设备上安装每个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
2020-07-07