'+entityForName: nil is not a legal NSManagedObjectContext parameter - Core Data

后端 未结 8 751
梦如初夏
梦如初夏 2020-11-28 22:26

I have added all of the relevant code to the App Delegate, and I am able to add to the data model and fetch from the data model in applicationDidFinishLaunchingWithOptions.<

8条回答
  •  心在旅途
    2020-11-28 23:09

    If the destination view controller is embedded in a NavigationController, the context needs to be set appropriately as follows-

      self.mydetailViewController = [[[segue destinationViewController] viewControllers] objectAtIndex:0];
     [self.mydetailViewController setManagedObjectContext:self.managedObjectContext];
    

提交回复
热议问题