【发布时间】:2017-10-02 12:41:55
【问题描述】:
Alamofire.request(NEWS_FEED_URL).responseJSON { response in
guard let newsResponse = response.result.value else{
print("Error: \(response.result.error)")
return
}
print("JSON: \(newsResponse)")
let localArray:Array = [newsResponse]
print("Local Array:", localArray)
}
I am using alamofire to fetch data from server and trying to write parser on the response data. When I fetch response.result.value from alamofire and print it is working fine. But as soon as I put response.result.value in my local array it gives
[<__NSArrayI 0x6080000bcf80>(
{
category = World;
})]
以此类推作为结果(控制台)。我也无法将“任何”类型的响应值转换为“数组”。请帮助我如何在“数组”类型的本地数组中添加 response.result.value。有人可以简要解释一下关于 alamofire 上的类型转换吗?
【问题讨论】:
标签: arrays json swift parsing alamofire