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 trialJoakim Wimmerstedt
1,482 PointsWhy haven't this been updated for xCode 6.1?
A lot of the API for swift seems to have changed, In this video it specifically seems to be NSString that is the problem.
var urlContents = NSString.stringWithContentsOfURL(location, encoding: NSUTF8StringEncoding, error: nil)
has to be
var urlContents = NSString(contentsOfURL: location, encoding: NSUTF8StringEncoding, error: nil)
for it to work.
In a prvious video, there was a problem with NSData as well, but we couldn't find a good solution for that (since we're beginners).
Joakim Birger Lie
12,367 PointsJoakim Birger Lie
12,367 PointsThe solution for the previous video was the following line:
let weatherData = NSData(contentsOfURL: forecastURL!, options: nil, error: nil)
Pretty similar to what had to be done with NSString. Move the "contentsOfURL" into the parentheses, along with having to unwrap the
forecastURL
constant.