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 Enhance a Weather App with Table Views Implementing the Detail View The End

Mathias Bakken
Mathias Bakken
3,167 Points

Final app doesn't work. Can't get info to display. I downloaded your project files and same issue. Please help!

Everything is accurate upon opening the weather app, when you select a day to see daily info, highs and lows don't work, nor do percip and humidity. What is happening? I have been trying to figure it out, but I have hit a brick wall.

By the way... I wanted to see if it might just be my code, so, I downloaded your project files and it has the same issue. What happened?

What version of Xcode are you using?

3 Answers

Brayden Kness
Brayden Kness
12,492 Points

Can you post some code?

Roberta Voulon
Roberta Voulon
5,792 Points

Silly question but have you entered your API key in the code you downloaded?

Weather values in the detail view are just showing default values! Help!

Are you having an issue with Stormy showing the default weather values in the detail view for the temperature, rain, and humidity labels? Here is how I fixed it.

I you look at Pasan's if-statement for the labels, you will notice they all have to pass for the values to show (not great, right?). What you have to do is check them all separately. Now I don't want the default values to show if nothing is available (or the app to crash), so I set the values to N/A. Here is my code to replace the if-statement in the detail view configureView method:

if let lowTemp = weather.minTemperature { lowTemperatureLabel?.text = "(lowTemp)ΒΊ" } else { lowTemperatureLabel?.text = "N/A" }

        if let highTemp = weather.maxTemperature {
            highTemperatureLabel?.text = "\(highTemp)ΒΊ"
        } else {
            highTemperatureLabel?.text = "N/A"
        }

        if let rain = weather.percipChance {
            precipitationLabel?.text = "\(rain)%"
        } else {
            precipitationLabel?.text = "N/A"
        }

        if let humidity = weather.humidity {
             humidityLabel?.text = "\(humidity)%"
        } else {
             humidityLabel?.text = "N/A"
        }

That is what fixed it for me.

this is not my solution btw....It is posted by one of the mods here...It does work for me...I didnt know how to quote someone elses comment so I copy pasted it here....this one works!!