2015-09-07 16 views
13

Tôi đã tích hợp google đăng nhập bằng google (không phải với cocoapod) và nó được xây dựng ok, nhưng khi tôi chạy dự án I luôn gặp lỗi này, sau khi đăng nhập:"Không có trình xử lý đăng ký cho lược đồ URL com-google-gidconsent" khi đăng nhập bằng GIDSignIn

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 

Đây là cách tôi đang sử dụng sdk.

Trước tiên, tôi làm theo tất cả các bước từ https://developers.google.com/identity/sign-in/ios/sign-in?ver=swift.

Code:
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() 
} 

gì có thể vấn đề này? Tôi đang sử dụng phiên bản SDK 2.2.0

Trả lời

29

Không có vấn đề với việc triển khai của bạn. Tất cả những cảnh báo này có nghĩa là các ứng dụng mà mỗi lược đồ URL đề cập đến không được cài đặt trên thiết bị.

Nếu bạn đang thử nghiệm trên trình giả lập, bạn sẽ luôn gặp phải các lỗi đó. Tuy nhiên, nếu bạn thử nghiệm trên thiết bị, bạn có thể xác minh lỗi sẽ biến mất nếu bạn đã cài đặt ứng dụng tương ứng.

Ví dụ, nếu bạn có ứng dụng Youtube trên điện thoại, bạn sẽ không nhìn thấy dòng:

2015-09-07 15:44:14.071 Contacts++[82438:4826277] LaunchServices: ERROR: There is no registered handler for URL scheme com-google-gidconsent-youtube 
-1
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.facebook.com"]]; 
     exit(0); 
}) 
+2

tâm giải thích? – CinCout

+0

Vui lòng giải thích cách giải đáp câu hỏi này. – JAL

Các vấn đề liên quan