filou
filou

Reputation: 1619

iOS: NSMutableArray is empty

for (XMLProductView *pV in entries) {
        NSString *test = pV.appName;
        [allTableData addObject:test];

        NSLog(@"Entries: %@", allTableData);
    }

In my NSString *test I get all results. Why does the NSMutableArray 'allTableData' show up Null?

Upvotes: 0

Views: 747

Answers (1)

ggrana
ggrana

Reputation: 2345

It is hard to say because you added just a few information, but probably you are not allocating it correctly.

Try to add it before your for:

allTableData = [[NSMutableArray alloc] init];
for (XMLProductView *pV in entries) {
    NSString *test = pV.appName;
    [allTableData addObject:test];
}
NSLog(@"Entries: %@", allTableData);

--

Edit

I edited the code to try to make it clear.

Upvotes: 5

Related Questions