Reputation: 75
I have a for loop,it contacts an array of strings to a part of a URL and then converts it to NSURL and pushes them one by one inside a mutablearray. The problem is that the mutableArray is null when i NSlog it outside the for loop. Here is the code:
for (int i = 0; i < news_Image.count; i++) {
concatURLS = [mediaURL stringByAppendingString:
[news_Image objectAtIndex:i]];
url = [NSURL URLWithString:concatURLS];
[urlArrays addObject:url];
}
Upvotes: 0
Views: 1068
Reputation: 3718
Do you ever allocate the mutable array?
You need to make sure that you are calling:
NSMutableArray * urlArrays = [[NSMutableArray alloc] init];
before the for loop.
Also, make sure news_image has been allocated as well.
Upvotes: 2