我有这个视图控制器:
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
警告/错误?这是否表明发生了什么?我已经搜索了它,却找不到任何有效的方法。 最佳答案
我错误地使用了稍微错误的URL。
关于swift - swift 4-HTTP请求未执行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47213724/