2016-12-27 65 views
0

我想尤伯杯融入我的應用程序尤伯杯SSO登錄錯誤雨燕2.3

使用此代碼添加尤伯杯登錄按鈕:

uberScopes = [.History, .Profile, .HistoryLite, .Places, .RideWidgets, .AllTrips, .Request, .RequestReceipt] 
    uberLoginManager = LoginManager(loginType: .Native) 
    let loginButton = LoginButton(frame: CGRectZero, scopes: uberScopes!, loginManager: uberLoginManager) 
    loginButton.presentingViewController = self 
    loginButton.delegate = self 
    loginButton.frame = logoutBgView.bounds 
    loginButton.autoresizingMask = 
     [.FlexibleWidth, .FlexibleHeight] 
    logoutBgView.addSubview(loginButton) 

並委派

func loginButton(button: LoginButton, didLogoutWithSuccess success: Bool) { 
     if success { 
      showMessage("Logout") 
     } 
    } 

    func loginButton(button: LoginButton, didCompleteLoginWithToken accessToken: AccessToken?, error: NSError?) { 
     if let _ = accessToken { 
      showMessage("Saved access token!") 
     } else if let error = error { 
      showMessage(error.localizedDescription) 
     } else { 
      showMessage("Error") 
     } 
    } 

代碼不工作在應用中使用本機類型登錄。當我點擊「登錄」重定向到safari然後應用程序商店(我有超級應用程序安裝),而不是去超級應用程序,以允許或拒絕我需要的範圍。我設置了重定向URI,客戶端ID,顯示名稱,服務器令牌。

有人可以幫助我嗎?

EDIT1:登錄錯誤:

2016-12-28 17:47:40.383 RexpenseSandbox[40681:530203] -canOpenURL: failed for URL: "uberauth://connect?third_party_app_name=xxxxxxxxxx &callback_uri_string=xxxxxxxxxxxxxxx&client_id=kEA5TjaXpT7QeicsvWLIYS-L3eWBpVZq&login_type=default&scope=history%20profile%20history_lite%20places%20ride_widgets%20all_trips%20request%20request_receipt&sdk=ios&sdk_version=0.6.0" - error: "(null)"

EDIT2 - 我在Testflight測試版本。當我在按鈕打開尤伯杯上的標誌敲擊但RedirectURI

+0

能否請您分享您的日誌? – agraebe

+0

@agraebe編輯帖子與日誌錯誤只覆蓋應用程序名稱和重定向uri – breadevelopment

+0

你是否遵循設置單一登錄與超級用戶說明:https://developer.uber.com/docs/riders/ride-requests/tutorials/ api/ios#native-login-with-uber-sso –

回答

0

基於該錯誤是不會出現的OAuth只是打開Safari,它看起來像你沒有必要的URL方案添加到您的info.plist的應用程序查詢計劃。請確保您有以下的info.plist

<key>LSApplicationQueriesSchemes</key> 
<array>           
<string>uber</string> 
<string>uberauth</string> 
</array> 

您可以閱讀tutorial for configuring the SDK更多的一些信息

+0

適合我,謝謝! – breadevelopment