I have a one-to-many relationship in my core data model. There can be many foods attached to one meal. I having a little difficulty with the code and have a few questions.
(1) If I just want to create a bunch of foods and do not want to attach them to a meal. Will this model accomplish that? For instance, I want to create Apple, Peach and Pear foods, but I do not want them assigned to a meal. Must I assign a Meal to each Food?
Food *food = [NSEntityDescription insertNewObjectForEntityForName:@"Food" inManagedObjectContext:self.context];
food.name = @"Apple";
food.type = @"Fruit";
OR
Meal *meal = [NSEntityDescription insertNewObjectForEntityForName:@"Meal" inManagedObjectContext:self.context];
// Create Food (same way as above)
[meal addFoodsObject: food];
(2) If I have separate classes each with their own Fetch Controller, does each class need their own context or can I share one from the App Delegate. For example, One class displays all the meals, and another displays all the foods.

(1) So long as your relationship is marked optional (the default) in the model builder, you
Foodobjects do not need aMeal.(2) You can use the main
NSManagedObjectContextfrom the application delegate, so long as you’re not doing anything that would violate its main thread confinement. (Which it doesn’t sound like you are doing…)