所以我有一個簡單的main.swiftEXC_BAD_ACCESS上Alamofire Github的例子
import Foundation
import Alamofire
Alamofire.request("https://httpbin.org/get").responseJSON { response in
print("Request: \(String(describing: response.request))") // original url request
print("Response: \(String(describing: response.response))") // http url response
print("Result: \(response.result)") // response serialization result
if let json = response.result.value {
print("JSON: \(json)") // serialized json response
}
if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
print("Data: \(utf8Text)") // original server data as UTF8 string
}
}
當我運行這一點,得到了「程序,退出代碼結束:0」,僅此而已。 我把斷點
Alamofire.request("https://httpbin.org/get").responseJSON { response in
,看到這一點 - 在 「responseJSON」 方法
問題。我做錯了什麼?來自Alamofire Github的簡單例子。
誰能給我解釋一下嗎?我只添加了這個代碼「RunLoop.current.run()」,它工作正常 – doublench