Singleton array deallocated? EXC_BAD_ACCESS

Posted by lclaud on Stack Overflow See other posts from Stack Overflow or by lclaud
Published on 2010-05-23T08:53:54Z Indexed on 2010/05/23 9:00 UTC
Read the original article Hit count: 277

Filed under:
|
|

Ok, so I have this singleton object and in it is an array that needs to be shown in a tableview. The thing is that it deallocates and after the first show, i get EXC_BAD_ACCESS in cellForRowAtIndexPath

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

count sent to dealocated instance of CFArray .. in cellForRowAtIndexPath.. WHAT is deallocating it? why? it's declarea as an NSMutableArray and has a (nonatomic,retain) property defined ..

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


  return cell;
}

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa