随机崩溃UITableView

时间:2010-12-13 13:21:53

标签: ios4 uitableview

我有一个带有自定义单元格的UITableView(包括从网站生成的uiimage),当我选择一行时,它会带我进入详细视图。现在,如果我在视图加载时单击一行,有时应用程序将崩溃。有时当我从详细视图返回主tableview时,应用程序将崩溃。我还没有粘贴我的代码,因为我真的不知道我甚至需要发布什么。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
selectedItems = [[stories objectAtIndex: storyIndex] objectForKey: @"title"];
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
dvController.imageArray = images;
dvController.selectedItems = selectedItems;
dvController.indexpath = storyIndex;
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"CustomCell"owner:self options:nil];
    cell = customCell;
    self.customCell = nil;
}
// Configure the cell.
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];

        cell.title.text = [[stories objectAtIndex: storyIndex] objectForKey: @"title"];



[cell.webview loadHTMLString:[NSString stringWithFormat:@"<html><body>%@</body></html>", [images objectAtIndex:indexPath.row]] baseURL:nil];
//NSLog(@"%@", [images objectAtIndex:indexPath.row]);
return cell;

}

NSLog报告说

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayerArray bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0x1bcd70'

didFailToReceiveAdWithError方法位于

之下
    - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    if (self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // banner is visible and we move it out of the screen, due to connection issue
        banner.frame = CGRectOffset(banner.frame, 0, -50);
        [UIView commitAnimations];
        self.bannerIsVisible = NO;
    }
}

1 个答案:

答案 0 :(得分:0)

你得到的错误......

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayerArray bannerView:didFailToReceiveAdWithError:]: unrecognized selector sent to instance 0x1bcd70'

......相当清楚。它与UITableView无关,而且与您未在ADBannerViewDelegate中实现bannerView:didFailToReceiveAdWithError:方法的事实有关。