I´m focusing on an application that shows 6 pictures from the website. These pictures change with time and so i removed the sourcecode of stated website and handled to drag the very first from the 6 pictures with this particular code:

NSError *error = nil

NSString *deviantStringPopular

deviantStringPopular = [NSString stringWithContentsOfURL:[NSURL     URLWithString:@"http://browse.deviantart.com/?order=24"]



NSString *popularContent

NSRange popularURLRange1 = [deviantStringPopular rangeOfString:@"super_img=""]

NSRange popularURLRange2 = [deviantStringPopular rangeOfString:@"" super_w"]

int lengt = popularURLRange2.location - popularURLRange1.location -     popularURLRange1.length

int location = popularURLRange1.location + popularURLRange1.length

NSRange endRange

endRange.location = location

endRange.length = lengt

popularContent = [deviantStringPopular substringWithRange:endRange]

NSLog(@"%@", popularContent)

The issue is, another 5 images' Web addresses are between your same substrings as the first. So is it feasible the first image's URL is overlooked when the it´s loaded effectively and also the second one loads and it is saved within different variable and so forth?

thanks ahead of time

To obtain 6 Web addresses in the string and load them into variables, you could attempt utilizing a loop. With every iteration, following the substring is located and saved right into a variable, create a are the start of the string as much as the finish from the substring you found. You should use stringByReplacingCharactersInRange to erase negligence the string already looked to ensure that next time you search the string for that substring, it'll discover the next URL.

An simpler solution might be to make use of RegexKit, knowing using RegEx's. Then each URL might just be a capture group.