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 trialGrant Powell
2,356 PointsString interpolation is not working. Getting unknown error.
Line 2 should work but does not.
let treehouseBaseURL = NSURL(string: "https://api.teamtreehouse.com/")
let courseURL = NSURL(string: "course/(COURSE_ID)", relativeToURL: treehouseBaseURL)
import Foundation
let treehouseCourseID = 25
// Add your code below
let treehouseBaseURL = NSURL(string: "https://api.teamtreehouse.com/")
let courseURL = NSURL(string: "course/\(COURSE_ID)", relativeToURL: treehouseBaseURL)
3 Answers
Grant Powell
2,356 PointsGot it, thanks.
Incidentally, it turned out the instructions were wrong. It was instruction me to use "courseID" as the variable name, but as you see in the code, the variable name is actually "treehouseCourseID".
Greg Kaleka
39,021 PointsHi Grant,
There's no variable in your code named COURSE_ID
, so Swift has no idea what you want there. If you're trying to pass in treehouseCourseID, you have to use that.
import Foundation
let treehouseCourseID = 25
// Add your code below
let treehouseBaseURL = NSURL(string: "https://api.teamtreehouse.com/")
let courseURL = NSURL(string: "course/\(treehouseCourseID)", relativeToURL: treehouseBaseURL)
Grant Powell
2,356 PointsThere's no variable in your code named COURSE_ID, so Swift has no idea what you want there. If you're trying to pass in treehouseCourseID, you have to use that.
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsOh interesting - after you complete a challenge, there's a link on the pop-up giving you your points where you can leave feedback. If you run into problems like this one, make sure you leave feedback.
Pasan Premaratne, you may want to have a quick look at this challenge's wording.
Pasan Premaratne
Treehouse TeacherPasan Premaratne
Treehouse TeacherThanks for the heads up!