My NSMutableArray full of Article (a custom class containing an NSString * title) objects gets loaded properly in one method (checked in debugger), but when another method is called the Article objects seem to 'forget' a number of class variables (like the title variable).
Here is the code that loads the Article objects into the NSMutableArray:
for(int i=0;i<[articleURLs count];i++) {
Article * a = [[Article alloc] init];
[a initWithWebsite:[articleURLs objectAtIndex:i]];
if([sectionTitle isEqualToString:@"Features"]) [featuresArticles addObject:a];
if([sectionTitle isEqualToString:@"News"]) [newsArticles addObject:a];
if([sectionTitle isEqualToString:@"Sports"]) [sportsArticles addObject:a];
if([sectionTitle isEqualToString:@"Leisure"]) [leisureArticles addObject:a];
if([sectionTitle isEqualToString:@"Voices"]) [voicesArticles addObject:a];
if([sectionTitle isEqualToString:@"Editorial"]) [editorialArticles addObject:a];
if([sectionTitle isEqualToString:@"Page 13"]) [page13Articles addObject:a];
[a release];
}
and here is the code in another method that looks for these values:
NSString *cellValue = @"ddd";
//NSArray * tempArray;
Article * a;
if([sectionTitle isEqualToString:@"Features"]) a = [featuresArticles objectAtIndex:indexPath.row];
if([sectionTitle isEqualToString:@"News"]) a = [newsArticles objectAtIndex:indexPath.row];
if([sectionTitle isEqualToString:@"Sports"]) a = [sportsArticles objectAtIndex:indexPath.row];
if([sectionTitle isEqualToString:@"Leisure"]) a = [leisureArticles objectAtIndex:indexPath.row];
if([sectionTitle isEqualToString:@"Voices"]) a = [voicesArticles objectAtIndex:indexPath.row];
if([sectionTitle isEqualToString:@"Editorial"]) a = [editorialArticles objectAtIndex:indexPath.row];
if([sectionTitle isEqualToString:@"Page 13"]) a = [page13Articles objectAtIndex:indexPath.row];
cellValue = [a getTitle];
I have been stuck on this for over 24 hours now, and the internet is not helping. Any suggestions?