Если вы хотите добавить URL-адреса в виде строк, не следует ли это -
for (int i = 0; i <= myInt; i++){
NSString *tempString = [[NSString alloc] initWithFormat : @"http://photostiubhart.comoj.com/GalleryImages/%dstiubhart1.jpg", i];
[myURLS addObject: [NSURL URLWithString:tempString]];
[tempString release];
}
be -
for (int i = 0; i <= myInt; i++){
NSString *tempString = [NSString stringWithFormat:@"http://photostiubhart.comoj.com/GalleryImages/%dstiubhart1.jpg", i];
[myURLS addObject:tempString];
}
Вы, вероятно, ожидаете, что они будут строками, а затем вызовете для них метод length
, тогда как они хранятся в виде URL-адресов в массиве.
Дополнительно , myPhotos
представляется свойством, и в этом случае вы можете заменить -
myPhotos = [[NSMutableArray alloc] init];
for(int i = 0; i < myInt; i++){
[myPhotos addObject:[myURLS objectAtIndex:i]];
}
с этим -
self.myPhotos = myURLS;
[myURLS release]; // To balance out the earlier alloc-init