我有一个 swiftyJSON 对象,例如:
[{
"location" : "http://...",
"img" : "http://...",
"commentCount" : 0,
"timestamp" : 1432460217550,
}]
我希望能够向其附加另一个 swiftyJSON 对象,使其看起来像:
[{
"location" : "http://...",
"img" : "http://...",
"commentCount" : 0,
"timestamp" : 1432460217550,
},
{
"location" : "http://...",
"img" : "http://...",
"commentCount" : 1,
"timestamp" : 1432460217571,
}
]
我不能使用+=
or .append
在 swiftyJSON 对象上。我怎样才能做到这一点?
正如您所说,swiftyJSON 没有附加功能。
您可以做的是将 swiftyJSON 对象解析为 anyObject 类型的数组并附加它们。
let json = JSON(data: data!)
var JSONObject = JSON(json["content"].arrayObject! + json["content"].arrayObject!)
Data-> 从 HTTP 请求接收到的 NSData 对象。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)