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 trialStefan Mach
3,691 PointsCompletely guessing
I don't even know what a pointer is. I believe we were told we would get to pointers, and now I am being told I was supposed to use one. Where was the syntax for an NSString in the context of a dictionary ever discussed prior to now? Please provide the correct code so I can note it in my notebook and move ahead. To anyone who is listening. Consider using what has been taught as what to contain within the challenges.
NSDictionary *artDict = @{
@"Artist": @"Dali",
@"Title": @"The Ship",
@"Medium": @"Oil Paint",
};
NSString *favoriteArtist;
favoriteArtist = [[artDict valueForKey:@"Artist"]stringValue];
2 Answers
Arman Arutyunov
21,900 PointsYou just don't need casting your value to string as it is already a string.
Correct code:
NSDictionary *artDict = @{
@"Artist": @"Dali",
@"Title": @"The Ship",
@"Medium": @"Oil Paint",
};
NSString *favoriteArtist = [artDict valueForKey:@"Artist"];
Stefan Mach
3,691 PointsThanks
Stefan Mach
3,691 PointsStefan Mach
3,691 PointsThanks,
Stefan