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

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!