Hi there,
I was following the book in 6th edition and I was able to fetch and print a jsonObject, which contains photos, but when I tried to instantiate Photos using the data parsed from the jsonObject it didn’t work.
It turned out that Flicker API doesn’t support “url_h” parameter anymore. Instead I use “url_o”, which is a URL to the image in original size.
See more here:
https://www.flickr.com/services/api/flickr.interestingness.getList.html
https://www.flickr.com/services/api/misc.urls.html
The easiest way to debug this for me was to put a print statement right after fetching the jsonObject to check if the format is correct and if all the extra parameters, which I requested, were provided.
static func photos(fromJSON data: Data) -> PhotosResult {
do {
let jsonObject = try JSONSerialization.jsonObject(with: data, options: [])
print(jsonObject)