Learn Courses My Dashboard

Help with Extra argument 'contentsOf' in call in JSON parsing

Hi!
I’ve been getting this error in my JSON parsing in my ContentModel.

I suspect that my problem is in my model but I cant find anything about it online. This is my model:

And this is the format of the incoming JSON data:

Any help is appreciated!

That line of code:

let jsonData = try Data(contentsOf: jsonUrl!)

looks correct to me. Have you tried cleaning your Build Folder? Keyboard shortcut to do that is Shift + Command + K

The build itself was fine but I ended up fixing it with:

let jsonData = try String(contentsOf: jsonUrl!).data(using: .utf8)

Thanks anyways!

1 Like