I have this UITableView app, a basic diary app, in this method XCode says I have a memory leak. The first line that leak is suggested to start is 117 "NSString *CellIdentifier". Down to if (cell ==..., to Diary *diaryEntry, to NSString *stringDate. There it states that the Method returns an object with a +1 retain count, owning. I've tried to release cell, stringDate... nothing changes this fact, so what am I thinking/doing wrong here?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// A date formatter for the time stamp static
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
Diary *diaryEntry = [diaryArray objectAtIndex:indexPath.row];
cell.textLabel.text = diaryEntry.diaryTitle;
NSString *stringDate = [[DiaryDateFormatter alloc] convertDateToString:[diaryEntry diaryDate]];
cell.detailTextLabel.text = stringDate;
[stringDate release];
return cell;
}