JSON Encoding | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5429634-saving-data-in-ios/lessons/14

You are an awesome teacher, but I think you should slow down a bit sometimes is a bit hard to follow you haha.

Thank you, I’ll definitely keep that in mind for future courses :slight_smile:

Just so much excitement and cool code to share :wink:

HI, I am using Swift 5 and Xcode 12. I am getting an data Corruped(swift.DecodingError(codingPath:[] …)
And fatal error while unwrapping the optional. I am just downloading ur code and running it. I followed all the steps u mention.Can you help?

Hi Nethrah,

I am not sure what may be happening without seeing a stack trace or understanding what took place prior to the crash/exception.

Two things to note from this video are:

  1. That corrupted error you mention may he indicative that your existing .json file contains a different format, or invalid data. Cleaning up this file should assist with that, which brings me to
  2. Now that in this video we delete the existing .json file from our sandbox and copy a new version from our project in order to prevent crashes or errors when attempting to load the file. Make sure you follow those steps to ensure you start with a fresh set of data from the expected file.

Thanks for taking the course and hope this helps :slight_smile:

@george30 Do you still have issues with this?