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 trialAvith Gutierrez
2,797 PointsApp Terminating, need support.
Hey i am having an issue with: 2014-10-09 17:48:35.906 stormY[1879:63421] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSPlaceholderData initWithContentsOfURL:options:error:]: nil URL argument' this is from the LOG.
This is my code
```import UIKit
class ViewController: UIViewController {
private let apiKey = "7b0e6589397f393a900cd6fc4df61906"
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//19.429418, -99.205582"
let baseURL = NSURL(string:"https://api.forecast.io/forecast/\(apiKey)/")
let forecastURL = NSURL(string:"19.429418, -99.205582", relativeToURL: baseURL)
let weatherData = NSData.dataWithContentsOfURL(forecastURL, options: nil, error: nil)
println(weatherData)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
Any ideas or suggestions?
4 Answers
Stone Preston
42,016 Pointstry removing the space between your coordinates
let forecastURL = NSURL(string:"19.429418,-99.205582", relativeToURL: baseURL)
Avith Gutierrez
2,797 PointsYou got it it worked for me :D i have already the data in JSON.
Removing the space was the issue.
Thanks.
Alex Gerdisch
2,165 PointsI too had to remove the space! Wow! Thanks Stone!
Asim Zaidi
2,222 Pointssame here ...needed to remove space. Wonder why though? I thought ios didnt care about spaces and should have handled through the core..no?
Kyle Rose
7,998 PointsKyle Rose
7,998 Pointsthis worked for me. It always amazes me how the simplest thing can make the entire program not function.
Eric Whittaker
2,974 PointsEric Whittaker
2,974 PointsI agree. Worked great stone. Thanks again.