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.

iOS Objective-C Basics (Retired) Foundation Framework NSDictionary

Wrong evaluation

The question is: The evaluation seems to be failing: The question is Declare an NSDictionary variable named 'album'. Assign the following key/pairs to it: "title" - "Abbey Road", "artist" - "The Beatles".

My answer is: NSDictionary *album = @{ @"title":@"Abbey", @"artist":@"The Beatles"};

I tested on Xcode and it worked.

nsdictionary.mm
NSDictionary *album = @{ @"title" : @"Abbey", @"artist" : @"The Beatles" };

3 Answers

William Li
PLUS
William Li
Courses Plus Student 26,867 Points

Hi, Ed Ag

The value of title key needs to be "Abbey Road", not "Abbey"

NSDictionary *album = @{ @"title" : @"Abbey Road", @"artist" : @"The Beatles" };

I tested on Xcode and it worked.

It's important to keep in mind that, there's a distinction between the code working on Xcode VS code passing the Code Challenge's Grader. Xcode is only checking your code for syntax error; while the grader's test case not only checks your code for error, it also evaluates whether the code did the exact thing in the exact way as instructed by the Code Challenge.

Thanks for your reply. I actually found the issue (@"Abbey" instead of @"Abbey Road") just after I posted the question, but didn't know how to delete the question.

William Li
William Li
Courses Plus Student 26,867 Points

Hi, Ed, good job at figuring out the right solution yourself.

didn't know how to delete the question.

If things haven't changed in the forum system, I believe normal user can't delete the post, only the moderators of the forum have the permission to do that. So if this happens again in the future, you figured out the answer after making a forum post, you may just add a comment on the post stating that you intend to delete the question since it's been resolved. We the forum moderators would be happy to do that for you. Cheers.

Good to know. Thanks again.