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 trialLuis Paulino
Courses Plus Student 1,779 PointsI need help with the second part of the challenge, but I can't ask for help the help button broken.
I have to assign a string value key for artdict? I'm sorry
NSDictionary *artDict= @{
@"Artist":@"Dali",
@"Title":@"The Ship",
@"Medium":@"Oil Paint",
};
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Luis.
First off, the help button seemed to work okay. The challenge and your code is linked properly.
Now, for task two, you will need to create a new string variable and then using valueForKey
assign the value from the Key "Artist" to the new String variable.
Below is the code needed for you to review. Have a look. If it still doesn't quite make sense, then have a quick look back at the video for review. :)
NSString *favoriteArtist = [artDict valueForKey:@"Artist"];
Keep Coding!
Luis Paulino
Courses Plus Student 1,779 PointsThank you, Jason sorry to be a bother you where a big help
Jason Anders
Treehouse Moderator 145,860 PointsNo bother at all. Just happy I could help :)
Luis Paulino
Courses Plus Student 1,779 PointsLuis Paulino
Courses Plus Student 1,779 PointsIt's still not working maybe it's my computer? Where do I put this string in or out of the NSSDict?
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsHey Luis Paulino
Not sure if you have it figured yet or not. You first part is correct.
Yes, Assigning the value to the String needs to be done outside of the Dictionary. So, the final code will look like
I did run the code through the challenge and it passed both, so I hope it worked out for you :)