I’ve got an array populated with json.
rows4 = [dict objectForKey:@"users"];
I have the following line that parses a key value from it.
NSString *hotelname = (NSString *) [rows4 valueForKey:@"H_NAME"];
I then assign the value to a label in the view with the following line:
LabelName.Text= hotelname;
Everything seems fine upto here. I write the log with Nslog as follows :
NSLog(@"HotelName : %@",hotelname);
This comes up in log:
[11437:f803] HotelName : (
“Blah Blah Hotel”
)
And then the simulator crashes with the following error in log:
NSArrayI isEqualToString:]: unrecognized selector sent to instance
What I understand from this is the variable that I assign to the label is actually not a variable but it is an array. Am I right? If so, how can I extract a single value from my variable with the help of a key and assign it to a variable which then I can assign to a label?
I am using touchJSON btw.
One option would be: