swift 4 - HTTP请求未执行

时间:2017-11-10 00:06:53

标签: swift http ssl url https

我有这个视图控制器:

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let button:HeaterButton = HeaterButton();
        button.setTitle("LOADING...", for: .normal);
        self.view.addSubview(button);

        self.getState();
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    //GET STATE OF ESP8266
    private func getState() {
        print("in get state");
        let url = URL(string: "http://cloud.arest.io/ew1zard");
        URLSession.shared.dataTask(with:url!, completionHandler: {(data, response, error) in
            if error != nil {
                print(error!.localizedDescription)
            }

            guard let data = data else { print("is nil"); return }
            print(data.description);
        }).resume()
    }
}

当我尝试运行它时,控制台输出为:

in get state
2017-11-09 19:02:30.508053-0500 HeaterControl[7887:2346290] refreshPreferences: HangTracerEnabled: 0
2017-11-09 19:02:30.508153-0500 HeaterControl[7887:2346290] refreshPreferences: HangTracerDuration: 500
2017-11-09 19:02:30.508191-0500 HeaterControl[7887:2346290] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
2017-11-09 19:02:30.782326-0500 HeaterControl[7887:2346367] [BoringSSL] Function boringssl_context_get_peer_sct_list: line 1754 received sct extension length is less than sct data length

什么是BoringSSL警告/错误?这是发生了什么的指标吗?我搜索过它,找不到任何有用的东西。

1 个答案:

答案 0 :(得分:0)

我错误地使用了一个稍微错误的网址。