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!
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
Kevin Zoltany
16,282 PointsNeed 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

Kevin Zoltany
16,282 PointsNo that didn't work. I still get the unresolved identifier.
1 Answer

Stone Preston
42,016 Pointsit 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.
Petr Michalek
8,618 PointsPetr Michalek
8,618 Pointsyou 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