keyNotFound error when parsing OpenWeather JSON data (SwiftUI)

后端 未结 1 1384
别跟我提以往
别跟我提以往 2021-01-26 13:19

I need to retrieve the \"name\" object by using openWeather API, and I manage to parse json and retrieve the data, but for its particular objects such as \"name\" I constantly r

1条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-26 14:09

    You are expecting a WeatherData object to contain 2 fields: name and main. But apparently, the actual data doesn't contain name. You need to double check the actual data you're trying to parse and update you WeatherData model.

    0 讨论(0)
提交回复
热议问题