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


Create an NSDictionary Object Code Challenge

The assignment is: Create an NSDictionary object called book1 with the following keys and values: 'Title' - 'Art of War', 'Author' - 'Sun Tzu'

And my code is: NSDictionary *book1 = [NSDictionary dictionaryWithObjectsAndKeys:@"Art of War", @"title", @"Sun Tzu", @"author", nil];

The response I get when I submit the code is: Remember, when declaring an NSDictionary the value comes first and then the key.

Isn't that what I'm doing?

2 Answers

Make sure the keys are @"Title" and @"Author", not @"title" and @"author".

And yes, you do have the correct ordering the code challenge's hint is a bit confusing unfortunately.

I made the same mistake with the caps. Thanks for the quick fix.