Ich habe ein Tutorial, das mit API, insbesondere die Openweathermap API spielte, gefolgt, und ich lief auf ein Problem und xCode gibt mir Optionen zu "Fix it mit! und ??", die leider nicht beheben das Problem entweder.Wert des optionalen Typs 'NSDictionary ??' nicht ausgepackt
if let urlContent = data {
do {
let jsonResult = try JSONSerialization.jsonObject(with: urlContent, options: JSONSerialization.ReadingOptions.mutableContainers) as? [String: Any]
print(jsonResult)
print(jsonResult?["name"])
if let description = ((jsonResult?["weather"] as? NSArray)?[0] as? NSDictionary)?["description"] as? String {
print(description)
}
} catch {
print("JSON Processing Fail")
}
Im einen Fehler auf if let description = ((jsonResult?["weather"] as? NSArray)?[0] as? NSDictionary)?["description"] as? String
als Wert der optionalen Art bekommen 'NSDictionary ??' nicht ausgepackt Fehler.