2010-12-13 22 views
0

私はカスタムセル(ウェブサイトから生成されたuiimageを含む)を持つUITableViewを持っています。そして、行を選択すると詳細ビューになります。ビューが読み込まれるとすぐに行をクリックすると、アプリがクラッシュすることがあります。ときどき私が詳細ビューからメインのテーブルビューに戻ると、アプリケーションがクラッシュすることがあります。私はコードを貼り付けるつもりはありません。なぜなら私が正直に何を投稿する必要があるのか​​わからないからです。無作為にクラッシュするUITableView

- (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; 
    } 
} 
未満であると言います
+2

クラッシュ時にNSLogが言っていること – iPrabu

+1

少なくとも、あなたの実装を 'tableView:cellForRowAtIndexPath:'に投稿する必要があると思います。 –

+1

私はあなたがデバッグビルドをしているとします。そのため、アプリがクラッシュしたときにコンソールにはどのようなエラーが報告されますか? –

答えて

0

あなたは...

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

を取得しているエラーが...かなり明確です。これはUITableViewとは何の関係もなく、ADBannerViewDelegateにbannerView:didFailToReceiveAdWithError:メソッドを実装していないという事実とは関係ありません。

+0

私はそこに持っていましたが、それでもエラーが出ます。上記のコードを追加しました。 –

+0

さて、それはエラーが言っていることです。あなたは正しいデリゲートクラスに正確なメソッドシグニチャーを持っていますか? –

関連する問題