swift - 带有 Dexcom API : get output frames failed, 状态 8196 的 OAuthSwift

标签 swift oauth oauth-2.0

我在使用带有 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”,这让我想到了相信授权过程没有正确完成。

我查看了以下资源,但还没有找到任何有用的信息。

感谢您的帮助。

最佳答案

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/

相关文章:

node.js - Dropbox api V2,在查询参数中获取访问 token 而不是 url 哈希 (#) (Nodejs)

swift - EKParcipant URL 访问崩溃的解决方法?

ios - 如何检查 SKSpriteNode 在单击时正在运行哪个 SKTexture

oauth - 如何在 WebAPI 中使用 Google Analytics oAuth?

ios - 在 iOS 应用程序中使用 GitHub 的 OAuth 身份验证 - 它是如何工作的

java - 如何在 Spring Boot 微服务应用程序之间传递用户 ID

c - 将 swift 字符串传递给 c 函数 char *

ios - AFNetworking 2 + SwiftyJSON

perl - 使用 Perl 和 Net::OAuth2 将 POST 事件传输到 Google 日历

oauth - 如果攻击者获得了应用程序的client_secret,他可以做什么?