mes application se bloque souvent dans cette boucle for:App plante souvent dans une boucle for
for (int a = 0; a <= 20; a++) {
NSString * foo = [[NSString alloc]initWithString:[[newsStories objectAtIndex:arc4random() % [newsStories count]] objectForKey:@"title"]];
foo = [foo stringByReplacingOccurrencesOfString:@"’" withString:@""];
foo = [[foo componentsSeparatedByCharactersInSet:[[NSCharacterSet letterCharacterSet] invertedSet]] componentsJoinedByString:@" "];
foo = [foo stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
textView.text = [textView.text stringByAppendingString:[NSString stringWithFormat:@"%@ ", foo]];
}
Le code change un NSString d'un NSDictionary et il ajoute dans un textView. Parfois, il se bloque pour la première fois en utilisant la boucle for. Qu'est-ce que j'ai mal?
Quel accident obtenez-vous? –
Il n'y a pas de message d'erreur dans le NSLog. – Flocked
Quel est le crash? ça dit quoi? Pas dans un NSLog mais dans le débogueur. – Chuck