swift - Uber 的 API 还稳定吗?我无法获得基本身份验证工作 IOS 13 swift 5.0
问题描述
正在尝试对 Uber 的 IOS Ride Request SDK 进行基本集成,我按照此处的说明进行操作https://developer.uber.com/docs/riders/ride-requests/tutorials/api/ios
当尝试对用户进行身份验证时,它会打开 Uber 应用程序,然后立即返回到我的应用程序。控制台打印“code=25 '用户取消登录过程。'”我使用的是带有 IOS 13 和 Swift 5.0 的真实设备。看起来 Uber Developers 社交媒体自 2017 年以来就没有更新过,而且看起来也不是很活跃。
信息列表
<key>UberClientID</key>
<string>907YWpr4cTwH9-TWVP0Fq8DX-_HuCxN3</string>
<key>UberDisplayName</key>
<string>Wandr</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>uber</string>
<string>uberauth</string>
</array>
<key>UberCallbackURIs</key>
<array>
<dict>
<key>UberCallbackURIType</key>
<string>General</string>
<key>URIString</key>
<string>com.wandrinc.Wandr://oauth/consumer</string>
</dict>
</array>
登录功能
func loginToUber() {
let loginManager = LoginManager()
loginManager.login(requestedScopes:[.request], presentingViewController: UIApplication.shared.keyWindow?.rootViewController!, completion: { accessToken, error in
if let error = error {
print(error)
return
}
self.requestRide()
})
}
应用代理
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
let handledUberURL = UberAppDelegate.shared.application(app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation] as Any)
return handledUberURL
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
let handledUberURL = UberAppDelegate.shared.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
return handledUberURL
}
输出
Error Domain=com.uber.rides-ios-sdk.ridesAuthenticationError Code=25 "User cancelled the login process." UserInfo={NSLocalizedDescription=User cancelled the login process.}
解决方案
推荐阅读
- python - Selenium 没有在 Python 中选择下拉菜单,没有错误
- javascript - React.js 设计模式:保存带有来自 *parent* 节点的多个字段的可编辑文档
- r - 在ggplot中将最小值和最大值添加为胡须
- windows - Windows 窗体应用程序在高 DPI 显示 VB 上显得模糊
- windows - 登录 Windows 帐户时启动 Bash 控制台
- php - PHP上传后Jar文件损坏
- javascript - 收到 Vue 警告 TypeError: Cannot read property of undefined but the data is present
- mongodb - 在 MongoDB 的 $lookup 上使用 $slice 和 $map?
- laravel - Laravel 与 OR 案例的关系
- tensorflow - 将 tf.set_random_seed 与 tf.estimator.Estimator 一起使用