Alamofireバージョン3.1.5をxCodeバージョン7.3で使用しています。私は私の多くのアプリで試してみました。しかし、私は結果が得られません。実行前にエラーは見られません。私のコードは次のようなものです:Alamofireを使用中に結果が得られません
var apiUrl : String
var alamoFireManager:Manager!
var configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
init(apiUrl : String){
self.apiUrl = apiUrl
configuration.timeoutIntervalForRequest = 30.0
alamoFireManager = Alamofire.Manager(configuration: configuration)
}
print(apiUrl)
alamoFireManager.request(.GET, apiUrl, encoding: .JSON).validate(contentType: ["application/json"]) .responseJSON { response in
print(response.result.value)
switch response.result{
case .Success:
if let value = response.result.value{
let json = JSON(value)
print (json)
callback.onResponse(value) // this is where my value is sent
}
case .Failure(let error):
print(error.localizedDescription)
}
}
私はブレークポイントを使用してチェックし、アプリケーションはこの最後の中カッコ内のアラモファラインに直接到達します。
を試し 'プリント(response.result.value)は'最終的に到達し得るのか? – luk2302
いいえ、そうではありません。 alamofireManagerの行から直接末尾の括弧に移動します –