Sunday, 18 August 2013

Can't add NSDictionary to NSArray

Can't add NSDictionary to NSArray

I'm trying to add an dictionary to an array to create an array on
dictionaries, but when I test the app, the array is still empty. Take a
look on my code:
NSMutableArray *listaEstabelecimentosPorCategoria;
for (NSDictionary *tempDict in listaEstabelecimentos) {
if ([[tempDict objectForKey:@"category"] integerValue] == 1) {
[listaEstabelecimentosPorCategoria addObject:tempDict];
NSLog(@"TEST");
}
}
NSLog(@"%@", listaEstabelecimentosPorCategoria);
The app prints this:
2013-08-18 12:16:38.802 Petroìpolis[10157:c07] TEST
2013-08-18 12:16:38.802 Petroìpolis[10157:c07] TEST
2013-08-18 12:16:38.803 Petroìpolis[10157:c07] (null)

No comments:

Post a Comment