首页 > 解决方案 > 带有 Dexcom API 的 OAuthSwift:获取输出帧失败,状态 8196

问题描述

我在使用带有 Dexcom API ( https://developer.dexcom.com/authentication ) 的 OAuthSwift 获取令牌然后发出请求时遇到问题。

这是我当前用于通过单击链接到登录和重定向的按钮来授权用户使用服务的代码。

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)
                         }
    )
}

有人可以指导我下一步应该做什么或我应该如何在这里提出请求吗?当我运行我的应用程序并单击调用授权函数的按钮时,我得到了似乎是在控制台中打印的令牌,但后面跟着几行“获取输出帧失败,状态 8196”,这导致我相信授权过程没有正确完成。

我查看了以下资源,但还没有发现任何有用的东西。

谢谢你的帮助。

标签: swiftoauthoauth-2.0

解决方案


iOS 12+ 具有健谈的网络日志记录。您的网络呼叫没有失败。

[BoringSSL] nw_protocol_boringssl_get_output_frames(1301) ... 获取输出帧失败,状态 8196

每次清理 URLSession 或显式调用 finishTasksAndInvalidate() 时都会输出此信息。

据我所知,如果不抑制所有操作系统日志记录,就无法抑制它,这是一个坏主意。如果有人知道如何专门禁止此消息,请回复。


推荐阅读