Je suis en train d'ajouter un UIWebView comme sous-vue d'un UITableViewCell afin d'afficher des données formatées avec l'application » MIMEType/xhtml + xml '. Même en initialisant simplement UIWebView comme décrit dans le code suivant, l'application plante!UIWebView dans le cadre d'un UITableViewCell: conduisant à tomber en panne à cause d'un blocage de fil
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"cellForRowAtIndexPath: '%d' in section '%d'", indexPath.section, indexPath.row);
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UIWebView * webView = [[UIWebView alloc]initWithFrame:cell.frame];
return cell;
}
Je reçois ce message:
bool _WebTryThreadLock (bool), 0x10a7f50: Tentatives pour obtenir le verrou web à partir d'un autre thread que le thread principal ou sur le Web fil. Cela peut être le résultat d'un appel à UIKit à partir d'un thread secondaire. Crashing maintenant ... <
Je n'arrive pas à comprendre où je me trompe!
Merci pour l'aide
Gerald
Wow! Tu as sauvé ma nuit! Seule la lecture du message ne me suffisait pas, tu m'as poussé à regarder en avant dans mon code. J'appelais la méthode reloadData dans un nouveau thread, a.k.a pas le thread principal! Un grand merci Eiko Salutations de France Gerald – Gerald
De rien. Été là, fait cela. N'hésitez pas à marquer cette réponse comme "acceptée". :-) – Eiko