The snapshot is only for sections and rows not for changes to the data being displayed in those rows. In your cell handler do not configure the cell instead just set the object on it and within a cell subclass observe NSManagedObjectContextObjectsDidChangeNotification notification and update the cell when necessary. Or you could just update all visible cells in the fetched results controller delegate method.Also I noticed another issue. Instead of controllerDidChangeContent you need to use the new delegate method didChangeContentWithSnapshot. That is called during the performFetch with the initial snapshot so there is no need to call applyFetchedDataToDataSource.
Post
Replies
Boosts
Views
Activity
You shouldn't be editing the snapshot, instead edit the model. I.e. delete the managed Object as follows:- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSManagedObjectContext *context = self.managedObjectContext;
NSManagedObjectID *objectID = [self itemIdentifierForIndexPath:indexPath];
Event *event = [context objectWithID:objectID];
[context deleteObject:event];
NSError *error = nil;
if (![context save:&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.
NSLog(@"Unresolved error %@, %@", error, error.userInfo);
abort();
}
}
}After deleting the object the didChangeContentWith snapshot object will be called.Note: You need to add a managedObjectContext property to your UITableViewDiffableDataSource subclass.
Same problem here, my personal Apple ID my Mac and iOS devices are signed in with is different from my developer Apple ID. I tried to add my personal Apple ID as an admin to my developer account but it won't work because a long time ago, before we even had CloudKit, I created a developer account using my personal Apple ID.I just contacted Apple to request they delete my dummy developer account that uses my personal Apple ID then I will first attempt to add my personal Apple ID as an admin to my developer account. If that doesn't work then I may contact Apple to request if they can change my developer Apple ID to my personal one, I think I have tried that a long time ago and it wasn't possible but maybe it is now.If anyone has any other ideas I'd be really interested. It would be a real pain to have to log in and out of Apple IDs just to use CloudKit, especially when working with sync that involves multiple devices.
Still an issue in newly released 13.4.My main problem is when a table is in split overlay mode (e.g. by default on iPhone X/XR/11) but hidden the rotation causes UITableView layoutSubviews which throws UITableViewAlertForLayoutOutsideViewHierarchy despite the table not being in the window.Apple please see FB7306484My current workaround involves subclassing UITableView with:#import "TableView.h"
@implementation TableView
- (void)layoutSubviews{
if(!self.window){
return;
}
[super layoutSubviews];
}
@endBut there are still cases where the issue occurs.I'm thinking about just ignoring this and going back to letting the table view be updated when not in a window too.
Lazy is for one-time initialization only. Since upon NSPersistentStoreCoordinatorStoresDidChangeNotification you need to re-initialize the NSFetchedResultsController you can't use lazy and must use something else.
Long standing bug rdar://43522696The workaround is to hide and unhide the nav bar: self.navigationController.navigationBarHidden = YES;
self.navigationItem.prompt = @"New Prompt";
self.navigationController.navigationBarHidden = NO;
A cell with a text field that is first responder and is scrolled off-screen is still considered being displayed - which is why didEndDisplayingCell is not called. This allows it to keep its text and still receive keyboard input. When the text field resigns first responder then didEndDisplayingCell is called.
I answered it here: https://stackoverflow.com/a/60085063/259521
Since selected rows are lost during reload first you need to save the selected rows then select them again after the reload. Also because there might be a deselection animation you might need to animateAlongsideTransition and call setNeedsLayout on the cell if it is visible or setNeedsLayout on the tableView if not.This all seems very messy.Has anyone thought about using NSBlockOperation and addExecutionBlock to collect all of the calls and then start it when regaining the window?
Thanks for the replies.I submitted FB7498558 which a copy of can be viewed publicly here http://www.openradar.me/radar?id=5062792444903424Yes they use a segue and the performSegue method can be seen, however interestingly it doesn't set the selectedRecipe so I was wondering how the method selectedRecipe retrieves the current selection if it uses the table view or if it searches the hierarchy to find it back from the detail controller that was segued to. Using table row selection for state is unreliable because setting editing clears the selection. Also they hook up a key command to an action that favourites the selectedRecipe, so I was wondering if that works on the selected row item or on the item showing the detail controller, in which case why doesn't the detail controller be the one handling the action.Another thing is the selectFirstRecipe method call, it can be seen as the last call in a method and I was wondering it is viewWillAppear which is where I would put it.