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

Mark McCuller
Mark McCuller
3,539 Points

Code Challenge What is NSDictionary? from IOS "Getting Data from the Web"

In the Code Challenge: Create an NSDictionary object called book1 with the following keys and values: 'Title' - 'Art of War', 'Author' - 'Sun Tzu'

I don't understand what is wrong with my answer? Thank you for your help, Mark. NSDictionary *book1 = [NSDictionary dictionaryWithObjectsAndKeys:@"Art of War",@"title",@"Sun Tzu",@"author", nil];

2 Answers

Nathan F.
Nathan F.
30,773 Points

I don't think I'm spoiling anything by saying this: your syntax is just fine, but in this example, it wants the keys to be capitalized: so use 'Title' and 'Author' instead of 'title' and 'author'. I had this same problem.

Mark McCuller
Mark McCuller
3,539 Points

You are correct, a capitalized "Title" and "Author" fixed the problem. Thank you very much, Nathan

Nathan F.
Nathan F.
30,773 Points

Happy to help.