How can I solve NSInternalInconsistencyException', reason: '+entityForName: fail report

前端 未结 2 2130
离开以前
离开以前 2021-01-21 08:47

My code looks like that:

NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
        NSEntityDescription *entity = [[self.fet         


        
2条回答
  •  死守一世寂寞
    2021-01-21 09:15

    Change the code in fetchedResultsController :

    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Obrat" inManagedObjectContext:self.managedObjectContext];
    

    to

    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Obrta" inManagedObjectContext:self.managedObjectContext];
    

    Entity named you create with Xcode must keep same with the NSEntityDescription in your code

提交回复
热议问题