I'm trying to get the hourly forecast from the Wunderground API but my code returns this error. I am interested in the forecast humidity for a specific hour of the day from the Wunderground API for a research project.
let currenttt = jsonResult["current_observation"] as NSDictionary
let currentttv = currenttt["display_location"] as NSDictionary
let c: String! = currentttv["city"] as NSString
this code works perfectly on http://api.wunderground.com/api/0c5ad177d8c2e097/conditions/q/CA/San_Francisco.json but what I need to add in order to obtain the Humidity in different hours.
I am trying to get the information of icon, I understand that it depends of the hour or other value that I need to add in order to get a specific “icon”.
let urlAsString "http://api.wunderground.com/api/0c5ad177d8c2e097/forecast/q/CA/San_Francisco.json"
let w = jsonResult["hourly_forecast"] as NSDictionary
let f = w["FCTTIME"] as NSDictionary
let a: String! = f["icon"] as NSString
the error is “The operation couldn’t be completed. (NSURLErrorDomain error -1001.)fatal error: unexpectedly found nil while unwrapping an Optional value(lldb) “
and “Thread 10: EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT,subcode=0xe7ffdefe)”