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 Objective-C Basics (Retired) Foundation Framework NSDictionary

Challenge 3 of NSDictionary

My bad, I am stuck again. [albumMutable setObject:@1969 forKey:@"year"]; I rechecked my work various times for silly mistakes, but this is the only way the video taught us how to do it.

1 Answer

Mike Baxter
Mike Baxter
4,442 Points

Watch the quotation marks around NSString literals. Should be @"1969". A literal is any Objective-C class you don't specifically allocate but create in-line, such as NSString, NSArray, NSDictionary. You can make all of them explicitly with the alloc->init paradigm, or save yourself time and do the literals. But if you do them as literals, you have to be careful to get the syntax right.

Here's a good list of the syntax for the literals:

http://cocoaheads.tumblr.com/post/17757846453/objective-c-literals-for-nsdictionary-nsarray-and