Post

Replies

Boosts

Views

Activity

How can I get NSPersistentCloudKitContainer working with UICollectionViewDiffableDataSource
I am trying to get CoreData(Sync'd via NSPersistentCloudKitContainer, although that is not particularly relevant for the current issue) to play nicely (or even at all) with UICollectionViewDiffableDataSource. The stumbling block seems to be concerned with [NSManagedObject hash]. I need the diffing engine to notice a change when there is a change in the specific managedObject-subclass, AND/OR (at least some) of its child managedObject-subclasses. Example: So, in the above example object graph, I need the Posts datasource to notice when the 'name' of the Tag changes, and react accordingly. i.e. {Post.tags.any.name} The simplest solution would be if I could override[Post hash], but of course that's not allowed. Even obj-c method-swizzling does not work without complaining. Class 'Post' for entity 'Post' has an illegal override of NSManagedObject -hash Adding 'computed values' with the parent managed-object does not work; computed vars don't seem to be included in the [hash] implementation. Any ideas what to try next?
0
0
798
Jun ’21
NSBatchUpdateRequest propertiesToUpdate using NSManObject?
Is it possible/allowed/supported to pass an NSManagedObject in the propertiesToUpdate dictionary of NSBatchUpdateRequest. obj-c MYManObjType* manObj = myManObject;/*Fetched using the same moc*/ NSBatchUpdateRequest* updateRqst = [NSBatchUpdateRequest batchUpdateRequestWithEntityName:@"relatedManObj"]; updateRqst.predicate = someValidPredicateDefinedElsewhere; updateRqst.propertiedToUpdate = @{@"myManObjRealtionship":manObj}; updateRqst.resultType = NSUpdatedObjectsCountResultType;... updateRqst.affectedStores = @[self.moc.persistentStoreCoordinator.persistentStores]; NSBatchUpdateResult* result = [self.moc executeRequest:updateRqst error:&err]; I keep getting this error: ** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid relationship ... But the relationship IS valid, and the 'assigned' object is of the correct type.
1
0
758
May ’21
NSCalendarNotificationTrigger: repeats: ?
I am trying to set a Notification that triggers on a certain day, then repeats each day after. So I need a NSCalendarNotificationTrigger, defining the FULL components set, (Year down to Minute/Second). But in this case, repeats does nothing at all. Which seems like an interesting, and not very flexible, design choice. Thus, it seems that I will need to create the single (non-repeating) calendar Noti, and, somehow, figure out how to replace it with a daily-repeating (hour and minute components) once it has fired. Any insight, or work-arounds appreciated. The old/deprecated since iOS 10, UILocalNotification could set a repeatInterval: (NSCalendarUnit), much more flexible. #LessIsNotMore
0
0
612
Feb ’21