I have a simple Grocery List app where I add items to the list. I want to save these items with Core Data so that the data is saved when the app is terminated.

I simply want to display all data, so if I understand correctly I don't need to implement an NS-FetchedResultsController for this. 

Right now, items are successfully adding in my CoreData, but the list only refreshes when I exit the app and re-open it.

So far I've tried putting `[self.tableView reloadData]`, `[[self tableView] reloadData]` and `[self.tableView reloadRowsAtIndexPaths:groceryArray withRowAnimation:YES];` in all the locations I could think of, including the viewDidLoad method, the unwindToSegue method that's coming from the Add Grocery Item List view controller, and also implementing a viewWillAppear method as well.

My mainAppDelegate code is straight from Apple and a tutorial... so I don't think this code is the problem. All properties and files are imported correctly.

My data entity is entitled "Item" and i have one single attribute titled "toDoItems" (type: string).

my TableViewController code which displays the list of data (and is not refreshing):

```
@interface XYZToDoListViewController ()
@end

@implementation XYZToDoListViewController
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
@synthesize groceryArray;

- (IBAction)unwindToList:(UIStoryboardSegue *)segue
{
    [[self tableView] reloadData];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    mainAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
    _managedObjectContext = [appDelegate managedObjectContext];

    NSFetchRequest *request = [[NSFetchRequest alloc]init];
    NSEntityDescription *items = [NSEntityDescription entityForName:@"Item" inManagedObjectContext:_managedObjectContext];
    [request setEntity:items];

    NSError *error = nil;
    NSMutableArray *mutableFetchResults = [[_managedObjectContext executeFetchRequest:request error:&error]mutableCopy]; if (mutableFetchResults == nil){
    //handle error
    }
    [self setGroceryArray:mutableFetchResults];

    [[self tableView] reloadData];    
    }

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        NSManagedObject *eventToDelete = [ groceryArray objectAtIndex:indexPath.row];
        [_managedObjectContext deleteObject: eventToDelete];

        [groceryArray removeObjectAtIndex:indexPath.row];
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
        NSError *error = nil;
        if (![_managedObjectContext save:&error])
        { //handle error 
        }
    }
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section
{

    return [groceryArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"ListPrototypeCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];

Item *items = (Item *) [groceryArray objectAtIndex:indexPath.row];
cell.textLabel.text = [items toDoItems];
return cell;
}

@end

```

My Add New Item view controller:

```
@interface XYZAddItemViewController ()
@property (strong, nonatomic) IBOutlet UIBarButtonItem *doneButton;

@end

@implementation XYZAddItemViewController
@synthesize textField;
@synthesize managedObjectContext = _managedObjectContext;
@synthesize managedObjectModel = _managedObjectModel;
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
Item *item = [NSEntityDescription insertNewObjectForEntityForName:@"Item" inManagedObjectContext:_managedObjectContext];
[item setToDoItems:textField.text];
NSLog (@"Item Added");
NSError *error = nil;
if (![_managedObjectContext save:&error])
    { //handle error }
        textField.text = NULL;
}

}

- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)segue sender:(id)sender {
if (self.textField.text.length > 0)
{
    return YES;
}
else {
    return NO;
}
} 

- (void)viewDidLoad
{
[super viewDidLoad];
mainAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
_managedObjectContext = [appDelegate managedObjectContext];

self.navigationController.view.backgroundColor =
[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_white.png"]];
self.view.backgroundColor = [UIColor clearColor];
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}

@end

```

What do I need to change to get the table view controller to refresh?