I am loading json into a list of objects I am adding to a NSMutableArray which seems to be working fine except for the fact that I can't seem to keep the array around to access later.
This is my .h:
@interface ClientController : UITableViewController {
NSMutableData *responseData;
NSMutableArray *ClientList;
}
@property (nonatomic, retain) NSMutableArray *ClientList;
In my .m I add:
@synthesize ClientList;
later I have a method that populates it (Client is a class I have as well):
/* some code that parses the Json */
for (int i = 0; i < [items count]; i++)
{
Client* client = [[Client alloc] init];
client.CompanyName = [[items objectAtIndex:i] objectForKey:@"CompanyName"];
client.ClientID = [[items objectAtIndex:i] objectForKey:@"ClientID"];
[ClientList addObject:client];
NSLog(@"CompanyName: %@\n", client.CompanyName);
[client release];
}
Console shows me that is is working properly because I see the data I expect BUT when I do this I get a null value:
NSLog(@"Clients Count: %@\n", [ClientList count]);
I need to loop though this to build my table - so what am I missing here?