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

前端 未结 2 2100
离开以前
离开以前 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

    0 讨论(0)
  • 2021-01-21 09:23

    You say you have an entity named "Obrta", but the code is creating an object of type "Obrat". Fixing that typo should fix your issue.

    0 讨论(0)
提交回复
热议问题