Well this is my code:
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"Row %i at View: %@",indexPath.row, [delegate.my_condition objectAtIndex:indexPath.row]);
if ([@"0" isEqualToString:[delegate.my_condition objectAtIndex:indexPath.row]]){
NSLog(@"Store is closed");
} else {
NSLog(@"Store is open");
and in log I do see:
2012-08-29 22:33:59.434 MyApp[2593:c07] Row 0 at View: 0
2012-08-29 22:33:59.435 MyApp[2593:c07] Store is open
2012-08-29 22:33:59.437 MyApp[2593:c07] Row 1 at View: 0
2012-08-29 22:33:59.438 MyApp[2593:c07] Store is open
2012-08-29 22:33:59.440 MyApp[2593:c07] Row 2 at View: 0
2012-08-29 22:33:59.441 MyApp[2593:c07] Store is open
So I do see that value is 0 but I do not see the if clause but the else clause.
Why is that?
myCondition is NSMutableArray
This is how I add items to my NSMutableArray:
NSString *parsed=[res objectForKey:@"Data"];
[delegate.my_condition addObject:parsed];
Are you sure that the values in
delegate.my_conditionare strings? Those look like they might beNSNumber*s. And of course anNSNumber*will never be equal to anNSString*.You may want to try something like
instead, which assumes that the value is either an
NSNumber*or anNSString*that represents a number.