带有Dexcom API的OAuthSwift:获取输出帧失败,状态8196

时间:2019-03-11 02:34:39

标签: swift oauth oauth-2.0

我在将OAuthSwift与Dexcom API(https://developer.dexcom.com/authentication)结合使用来获取令牌然后发出请求时遇到麻烦。

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

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: "jakestrickler://oauth-callback/dexcom") 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”,这使我认为授权过程未正确完成。

我查看了以下资源,但尚未发现任何有用的信息。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

iOS 12+具有闲聊网络日志记录。您的网络通话没有失败。

  

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

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

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