これが私のコードです:
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");
そしてログに私は見ます:
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
したがって、値が0であることがわかりますが、if句ではなくelse句が表示されます。
何故ですか?
myCondition is NSMutableArray
これが、NSMutableArrayにアイテムを追加する方法です。
NSString *parsed=[res objectForKey:@"Data"];
[delegate.my_condition addObject:parsed];