Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView not showing results until quit and reopen
    text
    copied!<p>I am using an NSFetchedResultsController to manage a UITableViewList of Gift objects. The idea is to let the user add Gifts by clicking the add button on the navbar. The add button should push a view for configuring the Gift onto the navigationController stack. Then, if the user actually enters data into the field, it should save the Gift so that if the user pops the view (i.e. navigates back to the list), he should see his new Gift in the list. Simple enough. The trouble is, that main list doesn't seem to update unless I reboot the app. Totally lost.</p> <p>Called when the user clicks the "+" button on the main tableview (giftlistcontroller.m)</p> <pre><code>-(void) addgift{ Gift *newGift = [NSEntityDescription insertNewObjectForEntityForName:@"Gift" inManagedObjectContext:self.managedObjectContext]; GiftEditController *editController = [[GiftEditController alloc] initWithStyle:UITableViewStyleGrouped]; editController.gift = newGift; [self.navigationController pushViewController:editController animated:YES]; [editController release]; } </code></pre> <p>Then, in GiftEditController, if the user updates a field...</p> <pre><code>- (void)textFieldDidEndEditing:(UITextField *)textField { if (textField == nameField) { gift.name = textField.text; } else if (textField == priceField) { gift.price = [NSNumber numberWithFloat:[textField.text floatValue]]; } NSError *error; if (![gift.managedObjectContext save:&amp;error]) { NSLog(@"Couldn't save in textFieldDidEndEditing"); } } </code></pre> <p>All of the standard fetchedresultscontroller delegate methods are defined in giftlistcontroller. Totally stumped, and any suggestions would be GREATLY (!!!!) appreciated.</p>
 

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