I have the error -[NSCFString stringValue]: unrecognized selector sent to instance 0x1578c when executing this code
I don't understand what I'm doing wrong
name is a NSString
self.searchValues= [[NSMutableArray alloc] init];
name=@"Bob";
if(self.name!=nil)
[searchValues addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Name",@"Label",self.name,@"Value",nil]];
NSLog(@"Array value : %s",[[[searchValues objectAtIndex:0] objectForKey:@"Value"] stringValue]);
Best Answer
Firstly, you can drop the [... stringValue] message. It isn't necessary, that object is already a string. Secondly, you should use %@ instead of %s for NSString objects.
Note: %@ works for any object at all, for that matter. Try
Trust me, it's worth trying.