Objective c 在UITableView中滚动时,错误的EXC\u访问错误

Objective c 在UITableView中滚动时,错误的EXC\u访问错误,objective-c,xcode,uitableview,exc-bad-access,Objective C,Xcode,Uitableview,Exc Bad Access,我使用以下代码启动了UITableView: ProductTableView *tableProd = [[ProductTableView alloc]initWithNibName:@"ProductTableView" bundle:nil]; xib文件确实存在 由于我在单独的UIView中显示此表,我通过以下方式将其添加到此屏幕: [content addSubview:tableProd.view]; 我使用xcode创建了一个标准UITableView,并设置了以下功能: -

我使用以下代码启动了UITableView:

ProductTableView *tableProd = [[ProductTableView alloc]initWithNibName:@"ProductTableView" bundle:nil];
xib文件确实存在

由于我在单独的UIView中显示此表,我通过以下方式将其添加到此屏幕:

[content addSubview:tableProd.view];
我使用xcode创建了一个标准UITableView,并设置了以下功能:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
   return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   static NSString *CellIdentifier = @"Cell";

   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   if (cell == nil) {
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
   }
   cell.textLabel.text = @"test";    
   return cell;
}
该表显示在模拟器中,其中10行充满测试。但是,当我开始滚动,第一个单元格离开屏幕时,模拟器崩溃,出现EXC_BAD_访问错误。我试着用仪器来检测僵尸,软件鞭打僵尸。不幸的是,我无法追溯这个错误的原因。


有人知道这里出了什么问题吗

如果要将视图控制器的视图添加为另一个视图控制器视图的子视图,我猜ProductTableView视图控制器正在被解除分配(因为作为子视图添加会保留视图,但不会保留它所属的视图控制器)


将ProductTableView控制器添加为容器视图控制器的属性,以便将其保留

是否已检查,是否已设置reuseidentifier,并且与xib中的代码相同?请粘贴tableview的didselect方法。Stacktrace表示在代码中调用了“DidSelectRowatingIndexPath:”。你能给我看一下这个代理吗?