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

2 Answers

Stone Preston
Stone Preston
42,016 Points

the reason yours is not working is that @1969 is an NSNumber literal when it should be a string literal @"1969". also 1969 is a not valid variable name (cant start with a number).

its probably better to just set the objects and keys all in one line and not make separate variables like you did. its looks a bit redundant the way you have it now.I would do it all in one like so:

[albumMutable setObject:@"1969" forKey:@"year"];

but if you wanted to do it the way you currently have it you just need to change your variable name and make it a string literal

NSString *year = @"year";
NSString *string1969 = @"1969";
[albumMutable setObject:string1969 forKey:year"];
Nicolas Acosta
Nicolas Acosta
1,587 Points

Thank you very much!! You really helped me!!

Nicolas Acosta
Nicolas Acosta
1,587 Points

Thank you very much!! You really helped me!!