I have an NSMutableArray which gets objects added to it from an NSDictionary.
These objects are values of either 1 or 0.
I am trying to loop through this NSMutableArray, to check each value. If it is 1, I set add a green tick image to an array, if it is zero, I add a red cross image to an array.
However I am getting the following error on checking the values of the NSMutableArray:
[__NSArrayI isEqualToString:]: unrecognized selector sent to instance
Here is my code:
facilitiesAvailable = [NSMutableArray new];
[facilitiesAvailable addObject:[[InfoDictionary valueForKey:@"wc-avail"]copy]];
[facilitiesAvailable addObject:[[InfoDictionary valueForKey:@"wifi_avail"]copy]];
tixArray = [NSMutableArray new];
for(NSString *avail in facilitiesAvailable) {
if([avail isEqualToString:@"1"]) {
[tixArray addObject:[UIImage imageNamed:@"greenTick.png"]];
} else {
[tixArray addObject:[UIImage imageNamed:@"redCross.png"]];
}
}
What am I doing wrong?
The message:
means that
availis an NSArray object and not an NSString as you expected, hence the error. You should check how you populate yourInfoDictionarydictionary, since it comes from there.