0

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];        
}
1
  • 1
    Post the code for creating the array. Commented Sep 9, 2013 at 20:19

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.