2
使用Alamofire 4.0和雨燕3.0這個作品:困惑Alamofire sessionmanager
Alamofire.request("http://content.uplynk.com/player/assetinfo/ab19f0dc98dc4b7dbfcf88fa223a6c3b.json", method: .get).responseJSON {
(response) -> Void in
print("Success: \(response.result)")
}
成功:成功
然而,當我嘗試使用SessionManager這樣我就可以包括timeoutInterval,我請求總是失敗
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 15
let alamofireManager = Alamofire.SessionManager(configuration: configuration)
alamofireManager.request("http://content.uplynk.com/player/assetinfo/ab19f0dc98dc4b7dbfcf88fa223a6c3b.json").validate().responseJSON {
response in
print("Success: \(response.result)")
print("Response String: \(response.result.value)")
}
成功:失敗
將不勝感激,如果有人可以幫助指向我在這裏正確的方向。
非常有幫助,這絕對解決了我的問題。非常感謝您花時間回答這樣一個徹底的答案和例子! –