我在使用带有 Dexcom API ( https://developer.dexcom.com/authentication ) 的 OAuthSwift 来获取 token 然后发出请求时遇到问题。
这是我当前使用的代码,通过单击链接到登录和重定向返回的按钮来授权用户使用该服务。
import UIKit
import OAuthSwift
class ViewController: UIViewController {
// UI Elements
@IBOutlet weak var resultLabel: UILabel!
@IBAction func authorizeTapped(_ sender: Any) {
authorizeDexcom()
}
var oauthswift: OAuth2Swift = OAuth2Swift(
consumerKey: "***",
consumerSecret: "***",
authorizeUrl: "https://sandbox-api.dexcom.com/v2/oauth2/login?",
accessTokenUrl: "https://sandbox-api.dexcom.com/v2/oauth2/token",
responseType: "code"
)
// Dexcom Test Functions
func authorizeDexcom() {
oauthswift.allowMissingStateCheck = true
oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift)
guard let rdURI = URL(string: "***") else {
return
}
oauthswift.authorize(withCallbackURL: rdURI,
scope: "offline_access",
state: "",
success: { credential, response, parameters in
print("SUCCESS")
print(credential.oauthToken)
}, failure: { error in
print(error.localizedDescription)
}
)
}
有人可以告诉我下一步应该做什么或者我应该如何在这里提出请求吗?当我运行我的应用程序并单击调用授权函数的按钮时,我在控制台中打印了一个 token ,但后面跟着几行“获取输出帧失败,状态 8196”,这让我想到了相信授权过程没有正确完成。
我查看了以下资源,但还没有找到任何有用的信息。
- get output frames failed, state 8196
- I'm testing login authentication in swift using firebase and getting errors get output frames failed, state 8196
- Borring SSl iOS 12
- OAuthSwift (1) connection
感谢您的帮助。
最佳答案
iOS 12+ 具有繁琐的网络日志记录。您的网络调用没有失败。
[BoringSSL] nw_protocol_boringssl_get_output_frames(1301) ... get output frames failed, state 8196
每次清理 URLSession 或显式调用 finishTasksAndInvalidate() 时都会输出此信息。
据我所知,如果不抑制所有操作系统日志记录,就无法抑制它,这是一个坏主意。如果有人知道如何具体禁止此消息,请回复。
关于swift - 带有 Dexcom API : get output frames failed, 状态 8196 的 OAuthSwift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55094535/