Singleton array deallocated? EXC_BAD_ACCESS
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;
}
Most likely you never retained shareddatabase when you set it.
精彩评论