【发布时间】:2018-05-15 13:48:06
【问题描述】:
我使用 Alamofire 和 SwiftyJson 从服务器解析 JSON。我在 tableView 中显示它,然后当我点击一行时,我会在网络上打开一个链接。
但我无法解析数组。
array`[
{
"title": " ",
"likes": 0,
"post_id": 60050,
"image": "",
"image1": "",
"image2": "",
"data": "",
"arguments": [
"link",
"url"
],
"provider": "custom",
"price": " usd",
"desc": "",
"shop": ""
},`
我的要求:
Alamofire.request("").responseJSON(completionHandler: { response in
if ((response.result.value) != nil) {
let swifts = JSON(response.result.value!)
if let resData = swifts.arrayObject{
}
self.dataTable = resData as! [[String:AnyObject]]
}
这显示文本:
cell.titleLabel.text = indexData["arguments "] as? String
但加载时出现错误:
Swift._SwiftDeferredNSArray 0x600000228cc0>( url
【问题讨论】:
-
数组中的dict。
-
我需要做什么?
-
我没有完全清楚你到底想做什么。如果你重写你的 json 和一些你想显示的代码,那就更好了。它有助于我理解。
-
我尝试解析“参数” - 到 tableView 并显示它并在视图之间移动
-
你能告诉我你的 Json 的正确结构,以便我可以帮助你。