I am populating an array with string objects. There can be thousands of these. I am doing a lot of alloc and inits inside a for loop, which I know is expensive. What is the better, more efficient way to do this?
Thanks
//loop through the array of dictionaries
for(NSUInteger i =0; i < [latestResults count]; i++){
self.workingEntry = [[AppRecord alloc] init];
//Get the next dictionary from the array of dictionaries
NSDictionary *currentRecord = [latestResults objectAtIndex:i];
//Set the object
[self.workingEntry setAppURLString:[currentRecord valueForKeyPath:@"id.label"]];
[self.workingEntry setAppName:[currentRecord valueForKeyPath:@"im:name.label"]];
NSArray *imageArray = [currentRecord valueForKeyPath:@"im:image.label"];
[self.workingEntry setImageURLString:[imageArray objectAtIndex:0]];
[self.workingEntry setArtist:[currentRecord valueForKeyPath:@"im:artist.label"]];
//Add object to array
[self.workingArray addObject:self.workingEntry];
currentRecord = nil;
self.workingEntry = nil;
imageArray = nil;
}
AppRecordallcopyproperties?