I'm not even sure what to call this problem. Much less how to search for a solution.
I'm using Xcode 4. I'm using CoreData. I have tab bar app. 4 different tabs. This is an issue from the simulator.
The root table view for two of the tab is populated by an array of controllers.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
SecondViewController *nextController = [self.medControllersArray objectAtIndex:row];
[self.navigationController pushViewController:nextController
animated:YES];
}
When drilling down to one of the controllers, there's another table table view as you can see.
When tapping the Add button in the next controller's table view and adding a name or whatever to populate the table view, if you go to another next controller's table view it is populated with the same info and the other table view.
Since I was getting the infamous +entityForName
error
I add this in viewDidLoad
if (managedObjectContext == nil)
{
managedObjectContext = [(MIT2AppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
NSLog(@"After managedObjectContext_: %@", managedObjectContext);
}
Add this in the app's delegate method application:didFinishLaunchingWithOptions
ViewController *viewController = [[ViewController alloc] init];
NSManagedObjectContext *context = [self managedObjectContext];
if (!context) {
NSLog(@"\nCould not create *context for self");
}
viewController.managedObjectContext = context;
I did this for each next view controller I had and the root views for the two tabs whose root view isn't populated by and array of controllers.
I also get this warning in the console when a next view is pushed:
After managedObjectContext_: <NSManagedObjectContext: 0x5934e10>
I hope it all makes sense. And that someone can point me in the right direction.
Thanks in advance.