【发布时间】:2016-09-21 15:40:28
【问题描述】:
我的代码有问题,在尝试解析 JSON 数据(数组的每个数据,例如应该如何完成)并尝试设置 for in 循环时,出现错误。这是我的代码
if let jsonDataArray = try? JSONSerialization.jsonObject(with: data!, options: [])
{
print(jsonDataArray)
var allStops = [busStops]()
for eachData in jsonDataArray
^
//this is where the error is located
{
if let jsonDataDictionary = eachData as? [String : AnyObject]
{
let eachStop = busStops(jsonDataDictiony: jsonDataDictionary)
}
}
}
【问题讨论】: