This is my first post so I hope the formatting is ok.
I’m getting this leak “Potential leak of an object on line” and I can’t figure it out. Perhaps I’m looking at it too hard and therefore I can’t see the problem. Could someone help me out?
The line is question is: appDelegate.imageText
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
PListFirstAppDelegate *appDelegate = (PListFirstAppDelegate *)[[UIApplication sharedApplication]delegate];
appDelegate.imageText= [[NSString alloc]initWithFormat:@"%@",[[array objectAtIndex:indexPath.row]objectForKey:@"image"]];
//NSLog(@"%@", appDelegate.imageText);
NavigationalDescription *detailViewController = [[NavigationalDescription alloc] initWithNibName:@"NavigationalDescription" bundle:nil];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
You should add an autorelease call at the end of that line.
iPad won’t let me copy paste code 🙁 so no example right now.
You are saying delegating control over the memory management to the imagetext instance. They should retain the string as they need it.