Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBryan Marks
3,987 PointsNo Code Errors but my Temperature is not changing :(
Debug Area is not showing any problems. I checked all the code from View Controller, Network Operation, Forecast Service and Current Weather quite a few times. The dark sky forecast is taking my calls.
Any suggestions on where to start?... Pretty sad after so many hours of work!
Gabe Nadel
Treehouse Guest Teacherfeel free to post your entire .m file and where you call the methods from, perhaps we can help.
Kris Larsen
8,015 PointsHello Bryan Marks
Where did you download the project code from??
5 Answers
mirza ullah
816 PointsSilly problem it is "https" not "http" remember
Adrian Perte
764 PointsNo errors on build , my temperatureLabel is not modifying but i get an error in console :
2015-10-07 22:25:40.463 Weathy[5285:3451067] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
Error: Not a valid HTTP response```
Rob Gough
2,637 PointsHave you checked the string you're using for the forecastBaseURL
starts with https
not just http
?
Bryan Marks
3,987 PointsThank you Gabe, I did get it to work however. Forgot one little line somewhere. Funny how sometimes nothing works without that one little line!
Gabe Nadel
Treehouse Guest TeacherHey Bryan, It isn't funny, it's the way this whole industry works :) You spend hours or days figuring out what's wrong and then fix it with something no longer than a tweet.
Btw, it is good practice to post what you found to actually be the problem and then how it was fixed - that may save a fellow student a lot of frustration down the line.
Ernie Ayon
3,441 PointsPlease share what you did to fix the code. I've looked over mine and it builds successfully, even shows the API is being called on forecast.io but the UI does not change.
Ernie Ayon
3,441 PointsI figured out what it was. My NetworkOperation file was missing the "completion(jsonDictionary)" statement after crating the JSON object with data in the case 200 http response code.
Gabe Nadel
Treehouse Guest TeacherThanks for posting when you figured out the issue. Doing that is SO helpful to future students!
J.R. Wright
18,003 PointsI did the same thing, except in my case I forgot to call completion(currentWeather) in the ForecastService getForecast() method. Sometimes you miss a thing or two when switching back and forth between watching the video and Xcode.
Ramesh VJ
2,201 PointsI'm using Xcode 7 the code executes without any error, but the label doesn't get updated
my part of code
if let httpResponse = response as? NSHTTPURLResponse{
switch(httpResponse.statusCode){
case 200:
print("getting positive response +++")
do {
print("getting positive response 2+++")
let jsonDictionary = try NSJSONSerialization.JSONObjectWithData(data!, options: []) as? [String: AnyObject]
completion(jsonDictionary)
print("getting positive response 4 ")
} catch let error {
print("JSON Serialization failed. Error: \(error)")
}
//let jsonDictionary = NSJSONSerialization.JSONObjectWithData(data!, options: []) as? [String: AnyObject]
//completion(jsonDictionary)
default:
print("GET request not successful. HTTP status code: \(httpResponse.statusCode)")
}
}else{
print("Error: Not a valid HTTP response")
}
the print statement "getting positive response 4" doesn't get printed. I used try catch as said in the forum in order to fix the error in Xcode 7. Please help put so much of efforts on it.
Bryan Marks
3,987 PointsBryan Marks
3,987 PointsSo I downloaded the project code and it worked with my API so it must be something wrong with the code ;/ guess i'll just comb through that.