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 trialKinsen Lee
1,501 PointsNSJSONSerialization.JSONObjectWithData - compilation error
My piece of code is as follow:
let userCourseDictionary : NSDictionary = NSJSONSerialization.JSONObjectWithData (userCourseData, options: nil, error: nil) as NSDictionary
The error points to the "nil" in options, the parameter. To me it seems that the syntax is exactly the same as in the previous video. (By the way this challenge follows the concurrency session within SWIFT weather app course)
Anyone encounter similar issue?
5 Answers
Robin Malhotra
14,883 PointsI personally haven't done much of the swift track, but try setting options to something like ''' NSJSONReadingAllowFragments '''
Jacopo Zamboni
1,982 PointsAbove worked fine for me.
arnavthecoder
3,453 PointsIt worked for me. Try it again.
Dulio Denis
14,457 PointsIts broke now with Swift 2.
Robin Malhotra
14,883 PointsDid syntax conversion work?
Dulio Denis
14,457 PointsI retreated from Xcode 7 Beta for now but will need to come back and use the new do {} try syntax since it throws an exception now in Swift 2.0.
Matthew Corby
2,685 PointsMatthew Corby
2,685 PointsI'm having the same exact issue. If someone could figure this out it would be greatly appreciated.