The following code is not working as expected. I am setting an array after creating a view but before displaying. I used NSLog to test that the array is set but the if/else sees the array as empty.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSLog(@"Planlist is nil %d / has %d objects", (planListArr == nil), [planListArr count]);
if (planListArr == nil || [planListArr count] == 0) { ... }
else {
NSLog(@"Planlist is empty");
}
}
Logs
2011-09-25 13:54:39.764 myVI[2938:13303] Planlist is nil 0 / has 8 objects
2011-09-25 13:54:39.765 myVI[2938:13303] Planlist is empty
PlanList is defined as
NSArray *planListArr;
@property (nonatomic, retain) NSArray *planListArr;