Post

Replies

Boosts

Views

Activity

Reply to NSFetchedResultsController with UITableViewDiffableDataSource update value
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.
May ’20
Reply to NFetchedResultsController delegate method didChangeContentWith is not called when deleted an item using UIDIffableDataSource tableview
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.
May ’20
Reply to Test Account us with CloudKit Dashboard
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.
Apr ’20
Reply to UITableViewAlertForLayoutOutsideViewHierarchy
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.
Apr ’20
Reply to UITableViewAlertForLayoutOutsideViewHierarchy
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?
Dec ’19
Reply to ChocolateChip WWDC 2019 sample code
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.
Dec ’19