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) Concurrency Working With JSON

Kevin Zoltany
Kevin Zoltany
16,282 Points

Need help with working with JSON code challenge

When I submit my code I get an unresolved variable even though it says “The code you write in each task should be added to the code written in the previous task.”

import Foundation

let jsonString : NSString = "{\"results\": \"success\"}"
let userCourseData : NSData = (contentsOfURL: courseURL)

let userCourseDictionary: NSDictionary =
NSJSONSerialization.JSONObjectWithData(userCourseData, options: nil, error: nil)
  as NSDictionary
Petr Michalek
Petr Michalek
8,618 Points

you may need something like this:

let userCourseDictionary: NSDictionary = NSJSONSerialization.JSONObjectWithData(userCourseData, options: nil, error: nil) as NSDictionary

at the end of your code you have two spaces just before as Dictionary

Kevin Zoltany
Kevin Zoltany
16,282 Points

No that didn't work. I still get the unresolved identifier.

1 Answer

Stone Preston
Stone Preston
42,016 Points

it looks like the code challenges may not be working right now. looking at your code it seems correct, however when I submit it I get a communication error.