【发布时间】:2010-06-22 20:46:27
【问题描述】:
我正在尝试添加 UIWebView 作为 UITableViewCell 的子视图,以便显示一些使用 MIMEType 'application/xhtml+xml' 格式化的数据。 即使只是按照以下代码中的描述初始化 UIWebView 也会导致应用程序崩溃!
- (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;
}
我收到了这条消息:
bool _WebTryThreadLock(bool), 0x10a7f50: 试图从主线程或web线程以外的线程获取web lock。这可能是从辅助线程调用 UIKit 的结果。现在崩溃了……
我不知道我哪里做错了!
感谢您的帮助
杰拉德
【问题讨论】:
标签: iphone uitableview uiwebview multithreading locking