Quelqu'un peut-il m'expliquer pourquoi je reçois un EXC_BAD_ACCESS sur ce morceau de code? J'ai couru Instruments avec Allocations et NSZombie activé, et il a dit que j'ai envoyé un message à un zombie, mais je ne peux pas voir ce qu'il en est.EXC_BAD_ACCESS dans la boucle
NSMutableArray *keys = [NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource: @"keys" ofType:@"plist"]];
//format: row, col
id myarray[4][13];
for (int row = 0; row<4; row++){
for (int col = 0; col<13;col++) {
myarray[row][col] = [keys objectAtIndex:0];
if (col < 13)
[keys removeObjectAtIndex:0];
}
}
for (int row = 0; row<4; row++){
for (int col = 0; col<13;col++) {
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
aButton.frame = CGRectMake(5+col*65,5+row*65, 60, 60);
NSLog(@"%@",myarray[row][col]);
[aButton setTitle:myarray[row][col] forState:UIControlStateNormal];
[aButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[keyboardView addSubview: aButton];
NSLog(@"%@",myarray[row][col]); //I think it is this NSLog causing problem
}
}
Voici les statistiques des instruments:
alt text http://i28.tinypic.com/24q1ixc.jpg
Merci
Merci! La gestion de la mémoire n'a jamais été la plus forte ... les docs d'Apple vont trop dans les détails à mon goût – joec