1
當我嘗試解析JSON數據(數組中的每個數據,比如應該如何完成)並嘗試設置在循環中,錯誤出來了。這裏是我的代碼類型'任何'不符合協議'序列'
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)
}
}
}