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

Khairul Akmal
Courses Plus Student 2,038 PointsCode Challenge - Formatting Dates with NSDateFormatter
I'm having this problem in Code Challenge - Formatting Dates with NSDateFormatter.
How do I get 10 days in advance using NSDate object? I've tried to use dateByAddingTimeInterval:
but still to no avail. Here's the error snapshot
I really appreciate for the help!
4 Answers

J Sherwani
248 PointsWhich line is causing the compile error? I'm pretty experienced with Objective-C and I'd be happy to help you via screen sharing on Screenhero, feel free to add me:

J Sherwani
248 PointsHey, it looks like we solved the problem! For all others that are stuck on this, dateByAddingTimeInterval is an instance method, and so you have to call it on an instance variable, not on the class.

Khairul Akmal
Courses Plus Student 2,038 PointsI really appreciate it :)

Stephen Whitfield
16,771 PointsGreat to have a pro here in the forums. Welcome J Sherwani!

Brett Kim
11,576 PointsAlso, J Sherwani , there's also NSDate *futureDate = [NSDate dateWithTimeIntervalSinceNow:secondsPerDay*10]; which works too. It's just a Treehouse compiler error (no spaces allowed)
Khairul Akmal
Courses Plus Student 2,038 PointsKhairul Akmal
Courses Plus Student 2,038 PointsHey! I've downloaded ScreenHero. Are you available now on ScreenHero? And I've added you already.