I'm trying to update my project to swift 3.0 and all codes about pulling data from server is give me this error in the following picture.
I tried a lot of solutions that is available here but with no useful result what is the problem in this case ?
do {
let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
if let countries = json["Countries"] as? [String: AnyObject] {
for country in countries {
if let couname = country["countryname"] as? [AnyObject] {
country_names.append(couname)
}
if let coucode = country["code"] as? [AnyObject] {
country_codes.append(coucode)
}
}
}
} catch {
print("Error Serializing JSON: \(error)")
}