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

General Discussion

__NSDictionaryM stringValue]: unrecognized selector sent to instance

if (self.postData) {

        NSMutableString *post = [NSMutableString string];

                for (NSString* key in self.postData) {
                    if ([post length] != 0) {
                        [post appendString:@"&"];
                    }

                    [post appendString:key];
                    [post appendString:@"="];


                    NSString* encodedValue = (NSString *)[[self.postData objectForKey:key]stringValue];
        //                        encodedValue = [encodedValue stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

                    [post appendString:encodedValue];
                }
        post = [[post stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"]mutableCopy];
         NSLog(@"post string=%@", post);

Please help. I am getting a crash at appendString. self.post is a dictionary here.

2 Answers

It helps to give us where you encountered the problem. Can you please post which lesson this is from exactly? It's important to know which lesson, because different lessons provide different ways to do the same thing. Thanks

I started my own project. This is not related to any lesson.

I think I figured this out. It was the wrong method that is been called on string within the dictionary for loop. I corrected this by replacing appendString to appendFormat.

Thanks :)