I have a function to convert html symbol from strings and then insert them into NSDictionary. I guess its probably method or syntax error.
Function to convert html value:
- (NSString *)convertMathSymbol:(NSString *)str{
str = [str stringByReplacingOccurrencesOfString:@"−" withString:@"− "];
str = [str stringByReplacingOccurrencesOfString:@"÷" withString:@"÷ "];
str = [str stringByReplacingOccurrencesOfString:@"&multiply;" withString:@"× "];
return str;
}
inserting into NSDictionary:
NSString *tempAns1 = [[sample objectAtIndex:0]objectAtIndex:1];
[answer setObject:[[self convertMathSymbol:tempAns1] forKey:@"1"]];
Error:
No visible @interface for 'NSString' declares the selector 'forKey:'
Appreciate any pointers… Thanx in advance…
You are sending a message to an NSString*, let me show you how.
You have:
Strip away the answer dictionary receiver, and you get:
See what I mean?
Try: