优步登录无法正常工作

时间:2017-11-27 00:31:47

标签: ios swift uber-api

我在使用iber应用程序进行超级登录时遇到问题。我已尝试使用loginButton并单独使用loginManager。

当单独使用loginManager并使用.native loginType时,我收到"错误域= com.uber.rides-ios-sdk.ridesAuthenticationError Code = 13"

尝试使用loginButton时,它甚至从未显示过。我在控制台中获得了一个巨大的打印输出(如下图所示。无法正确显示粘贴的文本)

debug console errors after trying to add login button subview

我尝试从头开始创建一个新项目,并且看到了loginButton和loginManager的相同行为(在修改App Signature以匹配新创建的项目之后)。我正在使用Xcode 9,Swift 4.0和UberRides ios SDK 0.7.0

我检查了"个人资料"开发人员仪表板中的常规范围,并已在iOS的“应用程序签名”部分下添加了我的软件包标识符

以下是我添加到Info.plist中的信息:

<key>UberClientID</key>
<string>[removed]</string>
<key>UberDisplayName</key>
<string>[removed]</string>
<key>UberServerToken</key>
<string>[removed]</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>uber</string>
    <string>uberauth</string>
</array>
<key>UberCallbackURIs</key>
<array>
    <dict>
        <key>UberCallbackURIType</key>
        <string>Native</string>
        <key>URIString</key>
        <string>[removed bundle identifier]://oauth/consumer</string>
    </dict>
</array>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>[removed bundle identifier]</string>
        </array>
    </dict>
</array>

这是我的loginButton代码(我还让视图控制器在LoginButtonDelegate中实现了这个代码,并添加了两个必要的函数(didLogoutWithSuccess和didCompleteLoginWithToken)以允许视图控制器充当代表)

    let scopes: [RidesScope] = [.profile]
    let loginManager = LoginManager(loginType: .native)
    let loginButton = LoginButton(frame: CGRect.zero, scopes: scopes, loginManager: loginManager)
    loginButton.presentingViewController = self
    loginButton.delegate = self
    loginButton.center = self.view.center
    self.view.addSubview(loginButton)

这是我用来尝试使用登录管理器的代码(我在尝试实现登录按钮时对此进行了评论):

        let loginManager = LoginManager(loginType: .native)
        loginManager.login(requestedScopes:[RidesScope.profile], presentingViewController: self, completion: { accessToken, error in
            // Completion block. If accessToken is non-nil, you’re good to go
            // Otherwise, error.code corresponds to the RidesAuthenticationErrorType that occured

            let ridesClient = RidesClient()
            ridesClient.fetchUserProfile(completion: {profile, response in
                if let error = response.error{
                    // handle error
                    print(error.code)
                }
                if let profile = profile{
                    // do something with profile

                }
            })

        })

如果您需要任何其他信息,请与我们联系。提前谢谢!

0 个答案:

没有答案
相关问题