Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Lei zheng
7,990 PointsNSData.getDatafromURL(...........) now change to NSdata(contentsOfURL: courseURL!, options: nil, error: nil)
this quiz I can not get pass.
import Foundation
let treehouseBaseURL = NSURL(string: "https://api.teamtreehouse.com/")
let courseURL = NSURL(string: "/course/\(courseID)", relativeToURL: treehouseBaseURL)
let courseData: NSData = NSData(contentsOfURL:courseURL!, options : nil, error : nil) as NSData
3 Answers

Chris Shaw
26,650 PointsHi Lei zheng,
Your answer is almost correct, the reason it doesn't pass is because the challenge isn't looking for an explicit type to be set for courseData
nor do you need to down cast it as an NSData
instance as it's already an instance of NSData
.
let courseData = NSData(contentsOfURL: courseURL!, options: nil, error: nil)
Happy coding!

agreatdaytocode
24,757 PointsChris your beating me to all the post lol. Good job man :)

Chris Shaw
26,650 Points Time for lunch, the throne is all yours

Lei zheng
7,990 Pointsthank you both. I copy and paste. it works. I remember I used the same code. including the courseURL! the bang mark there. But I don't know where I get wrong. You guys are awesome. But by the way, why you guys come back answer my question? are you guys paid?
or just to get high point?

agreatdaytocode
24,757 PointsI do it because, other MODs did the same for me when I started out at treehouse. I'm glad to return the favor. Im sure sometime in the near future Lei you will become a MOD too.
P.S we don't get paid in cash but we do take Karma points :)

Lei zheng
7,990 Pointsgot it. Yes, I will. I am on my way to that MOD position. I just wonder why codeschool did not get much traciton like treehouse forum. I basically a paid member on all the online course. But get most help from stackoverflow, dash and treehouse. thank you again. I love the word karma points. I will try to get some in near future.
agreatdaytocode
24,757 Pointsagreatdaytocode
24,757 PointsTry
let courseData = NSData(contentsOfURL: courseURL!, options: nil , error: nil)