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

How do I add NSString as stated in the 3rd question of the challenge? Or what did I do wrong?

Q3. Let's add the year of the album to the 'albumMutable' variable. Where the key is a NSString 'year' and the value is also a NSString '1969'.


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


Shawn Flanigan
Shawn Flanigan
Courses Plus Student 15,815 Points

Guyen,

Wish I could help you out, but I just started the Swift courses myself. Hope you get an answer soon!

No worries, thanks for your reply Shawn

1 Answer

Rami Ammoun
Rami Ammoun
7,468 Points

The compiler is considering your @1969 as an int. you should convert it to a string by adding the double quotation like this: @"1969"