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 trial

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.