malloc:***对象0x14d3e300的错误:双重免费CoreData

时间:2014-07-18 10:55:04

标签: ios objective-c uitableview core-data

我有这个函数来获取CoreData的数据。 此信息用于更新UITableView。

- (NSArray*)haveNewContentsInCategory{
    NSArray *aux = [self fetchAllReceiptCategorys];
    NSMutableArray *hiddens=[[NSMutableArray alloc] init];
    for (ReceiptCategory *rec in aux) {
        NSEntityDescription *entDesc = [NSEntityDescription entityForName:@"Content" inManagedObjectContext:self.managedObjectContext];
        NSFetchRequest *request = [[NSFetchRequest alloc] init];
        [request setEntity:entDesc];
        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"categoryId == %@",rec.catId];
        [request setPredicate:predicate];
        NSError *error;
        NSArray *results = [self.managedObjectContext executeFetchRequest:request error:&error];
        BOOL hidden=NO;
        for (Content *cont in results) {
            if ([cont.newContent boolValue]) {
                hidden=YES;
            }
        }
        [hiddens addObject:[[NSNumber alloc] initWithBool:hidden]];
    }
    return hiddens;
}

查看控制器

- (void)viewWillAppear:(BOOL)animated{
    categorys = [[CoreDataManager instance] fetchAllReceiptCategorys];
    hiddens = [[CoreDataManager instance] haveNewContentsInCategory];
    [_tvTable reloadData];
}

第一次按下视图时,一切正常。但是当我第二次进入这个视图时会发生这种错误。

  

malloc: *对象0x14d3e300的错误:双倍免费   * 在malloc_error_break中设置断点以进行调试

0 个答案:

没有答案