-1

好的,所以我有这个单例对象,其中有一个需要在表格视图中显示的数组。问题是它释放了,在第一次演出之后,我在 cellForRowAtIndexPath 中得到了 EXC_BAD_ACCESS

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 return [[dataBase shareddataBase].dateActive count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"celula"];
 int i;
 i=indexPath.row;
 if (cell==nil) {
  cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"celula"];
 }

计数发送到 cellForRowAtIndexPath 中的 CFArray .. 的已释放实例 .. 什么是释放它?为什么?它被声明为 NSMutableArray 并定义了 (nonatomic,retain) 属性..

 if ((i<[[dataBase shareddataBase].dateActive count])&&(i>=0)) {
  NSDictionary *d=[[dataBase shareddataBase].dateActive objectAtIndex:i];
  cell.textLabel.text=[d objectForKey:@"detaliu"];
 }


  return cell;
}
4

1 回答 1

0

很可能您在设置时从未保留共享数据库。

于 2010-05-23T16:38:23.700 回答