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

ajor
ajor
8,216 Points

Why do I keep getting an error message even though my code is correct?

I am working on task #3 of the NSDictionary challenge and keep getting the error message that my set date is not correct. However, I did set the release year to the value of 1969.

NSDictionary *album = @{ @"title": @"Abbey Road", @"artist": @"The Beatles"}; NSMutableDictionary *albumMutable = [NSMutableDictionary dictionaryWithDictionary:album]; [albumMutable setObject:@1969 forKey:@"year"];

What did I do wrong?

nsdictionary.mm
NSDictionary *album = @{ @"title": @"Abbey Road", @"artist": @"The Beatles"};
NSMutableDictionary *albumMutable = [NSMutableDictionary dictionaryWithDictionary:album];
[albumMutable setObject:@1969 forKey:@"year"];

2 Answers

Edwin Vergara
Edwin Vergara
6,477 Points

the value 1969 needs to be a string. @"1969"

ajor
ajor
8,216 Points

Edwin, thank you so much for your help! It worked!