アイテムのリストを UITableview にロードし、クリックして選択した行のアラートを表示することができました。しかし、アラートで「OK」と言った後、すでに選択されている行を再クリックすると、「スレッド 1: プログラムが信号を受信しました:EXC_BAD_ACCESS」と言ってコードが壊れます。以下のコードを見てください。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *playerselected = [exercises objectAtIndex:indexPath.row];
NSString *video = [playerselected valueForKey:@"video"];
NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@", video];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Player selected"
message:msg
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[video release];
[msg release];
}
ここで何が問題なのか教えてください。