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 (Retired) Displaying Our Weather Data Connecting the UI to Our Model

App crashes due to error in the main story saying the value for humidity and rain will be at different run time

/Volumes/Transcend/Development/Stormy/Stormy/Base.lproj/Main.storyboard Frame for "0.88" will be different at run time. /Volumes/Transcend/Development/Stormy/Stormy/Base.lproj/Main.storyboard Frame for "0.70" will be different at run time.

What do i do?

4 Answers

Hi Marvin,

When is this happening? They read like warnings, not results of a crash. Does your console have any other output that might help us track the issue down?

Steve.

it happens after i run the app. here is my console

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var currentTimeLabel: UILabel!
    @IBOutlet weak var temperatureLabel: UILabel!
    @IBOutlet weak var humidityLabel: UILabel!
    @IBOutlet weak var precipitationLabel: UILabel!
    @IBOutlet weak var summaryLabel: UILabel!

    let apiKey = "da0e4ec22adadb1c52fcfb7b597c2b97"

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        let baseURL = NSURL(string: "https://api.forecast.io/forecast/\(apiKey)/")
        let forecastURL = NSURL(string: "37.8267,-122.423", relativeToURL: baseURL)

        let sharedSession = NSURLSession.sharedSession()
        let downloadTask: NSURLSessionDownloadTask = sharedSession.downloadTaskWithURL(forecastURL!, completionHandler: { (location: NSURL!, response: NSURLResponse!, error: NSError!) -> Void in

            if (error == nil) {
                let dataObject = NSData(contentsOfURL: location)
                let weatherDictionary: NSDictionary = NSJSONSerialization.JSONObjectWithData(dataObject!, options: nil, error: nil) as NSDictionary

                let currentWeather = current(weatherDictionary: weatherDictionary)

                dispatch_async(dispatch_get_main_queue(), { () -> Void in
                    self.temperatureLabel.text = "\(currentWeather.temperature)"
                })
            }

        })
        downloadTask.resume()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

Hi Marvin,

The error is something related to your storyboard, it seems. When the app crashes, do you not get a load of output in Xcode detailing load of stuff about the error (most of which is unreadable!). The clue will lie in there, not in your code.

If you could paste the whole error output into here, that would help.

Steve.

Hi Steve, did you mean the codes at the debugging area after i run the app?

2015-04-07 18:01:26.570 Stormy[40501:2119259] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Stormy.ViewController 0x7f8249535b30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key temparatureLabel.' *** First throw call stack: ( 0 CoreFoundation 0x0000000108a45a75 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010a59dbb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000108a456b9 -[NSException raise] + 9 3 Foundation 0x0000000108e60d43 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 4 CoreFoundation 0x000000010898f5e0 -[NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x000000010959f4ed -[UINib instantiateWithOwner:options:] + 1506 6 UIKit 0x00000001093fda88 -[UIViewController _loadViewFromNibNamed:bundle:] + 242 7 UIKit 0x00000001093fe078 -[UIViewController loadView] + 109 8 UIKit 0x00000001093fe2e9 -[UIViewController loadViewIfRequired] + 75 9 UIKit 0x00000001093fe77e -[UIViewController view] + 27 10 UIKit 0x000000010931d509 -[UIWindow addRootViewControllerViewIfPossible] + 58 11 UIKit 0x000000010931d8a1 -[UIWindow _setHidden:forced:] + 247 12 UIKit 0x0000000109329f8c -[UIWindow makeKeyAndVisible] + 42 13 UIKit 0x00000001092d40c2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732 14 UIKit 0x00000001092d6e3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349 15 UIKit 0x00000001092d5d35 -[UIApplication workspaceDidEndTransaction:] + 179 16 FrontBoardServices 0x000000010bd3e243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16 17 CoreFoundation 0x000000010897ac7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12 18 CoreFoundation 0x00000001089709c5 __CFRunLoopDoBlocks + 341 19 CoreFoundation 0x0000000108970785 __CFRunLoopRun + 2389 20 CoreFoundation 0x000000010896fbc6 CFRunLoopRunSpecific + 470 21 UIKit 0x00000001092d57a2 -[UIApplication _run] + 413 22 UIKit 0x00000001092d8580 UIApplicationMain + 1282 23 Stormy 0x000000010844e84e top_level_code + 78 24 Stormy 0x000000010844e88a main + 42 25 libdyld.dylib 0x000000010ad79145 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)