Я получаю сообщение «Потенциальная утечка» после выполнения анализа этого кода, который, кстати, работает отлично, без ошибок и сбоев (это просто бит UINavigationController / TableView.)
Полное сообщение, которое я получаю: «Потенциальная утечка объекта, выделенного и сохраненного в« tempKey »»
Это не имеет смысла для меня - кто-нибудь может это увидеть?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// create a tempKey String var, which will store the clicked-artist's name
// -- this here is the line the compiler says the error is in:
NSString *tempKey = [[NSString alloc] init];
if ([ArtisticStaffNames objectAtIndex:indexPath.row] == @"Jeff Smith")
tempKey = @"Jeff";
else if ([ArtisticStaffNames objectAtIndex:indexPath.row] == @"Dan Jones")
tempKey = @"Dan";
else if ([ArtisticStaffNames objectAtIndex:indexPath.row] == @"Matt Low")
tempKey = @"Mat";
else if ([ArtisticStaffNames objectAtIndex:indexPath.row] == @"Lisa Jennings")
tempKey = @"Lis";
else if ([ArtisticStaffNames objectAtIndex:indexPath.row] == @"Michael Bluarique")
tempKey = @"Mike";
artisticStaffDetailVC *artStaffVC = [[artisticStaffDetailVC alloc] initWithNibName: @"artisticStaffDetailVC" bundle:nil];
artStaffVC.key = tempKey;
[tempKey release];
// Sets the text of the BACK button on next screen to "back":
// alloc a UIBarButtonItem:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
backButton.title = @"Staff";
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
// Pushes the next view/screen on:
[self.navigationController pushViewController:artStaffVC animated:YES];
[artStaffVC.key release];
}