开发者

Randomly crashing UITableView

I have a UITableView with a Custom Cell, (includes a uiimage generated from a website) and when I select a row it takes me to a detail view. Now if I click on a row as soon as the view loads, sometimes the app will crash. Sometimes when I return to the main tableview from the detail view the app will crash. I am not going to paste my code yet because I honestly have no idea what I would even need to post.

- (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;

}

The NSLog report says

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

The didFailToReceiveAdWithError method is below

    - (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;
    }
}


The error you're getting...

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

...is fairly clear. It's nothing to do with the UITableView and everything to do with the fact that you've not implemented the bannerView:didFailToReceiveAdWithError: method in your ADBannerViewDelegate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜