Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Thanks everyone for your help. I finally found the solution, and I thought it would be wise to post it for anyone else with this problem (a simple google search makes one think there are more than a few out there).</p> <p>You were right, I needed to reload my table. But that wasn't enough. The problem was that I had just dropped in the boilerplate <strong>fetchedResultsController</strong> code that apple uses, which doesn't work in this case. In particular, the first few lines of fetchedResultsController read:</p> <pre><code>-(NSFetchedResultsController *)fetchedResultsController if (fetchedResultsController != nil) { return fetchedResultsController; } .... } </code></pre> <p>The problem is, even if one refreshes the table, it is still using the old fetchedResultsController which is unaware of the new entry. I was able to fix this problem by updating the fetchedResultsController in <strong>viewDidAppear</strong>:</p> <pre><code>- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // Set the fetched results controller to nil in case we are coming back // from a view that added or removed entries. self.fetchedResultsController = nil; NSError *error = nil; if (![[self fetchedResultsController] performFetch:&amp;error]) { /* Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button. */ NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } //reload the table to catch any changes [self.tableView reloadData]; } </code></pre> <p>Thank you James Webster and Louie. You guys are lifesavers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload