“The data couldn’t be read because it is missing” error when decoding JSON in Swift

后端 未结 5 574
温柔的废话
温柔的废话 2021-01-31 07:20

I am getting the following error :

The data couldn’t be read because it is missing.

When I run the following code:

struct Indicator: Decodable {
         


        
5条回答
  •  梦毁少年i
    2021-01-31 08:26

    Try printing the actual error instead of just the description. It should give you a message like "No value associated with key someKey (\"actual_key_if_you_defined_your_own\").", which is much more useful than the localizedDescription.

提交回复
热议问题