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 trial

iOS Build a Weather App with Swift Managing Complexity Grand Central Dispatch

No 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!

So 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.

Gabe Nadel
seal-mask
.a{fill-rule:evenodd;}techdegree
Gabe Nadel
Treehouse Guest Teacher

feel free to post your entire .m file and where you call the methods from, perhaps we can help.

Kris Larsen
Kris Larsen
8,015 Points

Hello Bryan Marks

Where did you download the project code from??

5 Answers

Silly problem it is "https" not "http" remember

No 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```

Have you checked the string you're using for the forecastBaseURL starts with https not just http?

Thank 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
seal-mask
.a{fill-rule:evenodd;}techdegree
Gabe Nadel
Treehouse Guest Teacher

Hey 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.

Please 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.

I 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
seal-mask
.a{fill-rule:evenodd;}techdegree
Gabe Nadel
Treehouse Guest Teacher

Thanks for posting when you figured out the issue. Doing that is SO helpful to future students!

J.R. Wright
J.R. Wright
18,003 Points

I 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.

I'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.