nsfetchedresultscontroller

NSFetchedResultsController doesn't call controllerDidChangeContent: after update to non-fetched NSManagedObject

我的未来我决定 提交于 2019-11-27 02:14:41
问题 I populate and save: an initial NSManagedObjectContext setup an NSFetchedResultsController with a different NSManagedObjectContext , which filters on a boolean "show" attribute. Finally update "show" on yet another NSManagedObjectContext and save: . I expect that this should cause my NSFetchedResultsController to call NSFetchedResultsControllerDelegate 's controllerDidChangeContent: . I never get that call. NSFetchedResultsController with predicate ignores changes merged from different

Core Data does not react on changed predicate

谁都会走 提交于 2019-11-26 23:41:10
问题 This is a strange issue. In my view controller SpieleOrtTVC I am going to present a subset of the objects of the entity Spiel . Every time the view controller is called a different subset should be displayed based on the users's selection within the presenting view controller. This works just well for each first time the view controller is called. Depending on the user's selection, fetch creteria is handed over to the new view controller and actually arrives there correctly, as the NSLogs

Core Data - How to fetch an entity with max value property

旧巷老猫 提交于 2019-11-26 22:47:28
问题 I have a entity Person with a property personId (personId is unique) How can I fetch the Person with the max personId? (I want to fetch the person itself not the value of the property) 回答1: You set the fetchLimit to 1 and sort by personId in descending order. E.g.: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Person"]; fetchRequest.fetchLimit = 1; fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"personId" ascending:NO]]; NSError *error

NSFetchedResultsController v.s. UILocalizedIndexedCollation

邮差的信 提交于 2019-11-26 21:57:24
I am trying to use a FRC with mixed language data and want to have a section index. It seems like from the documentation you should be able to override the FRC's - (NSString *)sectionIndexTitleForSectionName:(NSString *)sectionName - (NSArray *)sectionIndexTitles and then use the UILocalizedIndexedCollation to have a localized index and sections. But sadly this does not work and is not what is intended to be used :( Has anyone been able to use a FRC with UILocalizedIndexedCollation or are we forced to use the manual sorting method mentioned in the example UITableView +

NSFetchedResultsController custom sort not getting called

自古美人都是妖i 提交于 2019-11-26 20:44:04
问题 I am currently trying to populate a UITableView in my project from Core Data using NSFetchedResultsController. I am using a custom search with a comparator (although I have also tried a selector and had an identical problem): if (fetchedResultsController != nil) { return fetchedResultsController; } /* Set up the fetched results controller. */ // Create the fetch request for the entity. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate.

Changing a managed object property doesn't trigger NSFetchedResultsController to update the table view

a 夏天 提交于 2019-11-26 19:53:52
I have a fetchedResultsController with a predicate, where "isOpen == YES" When calling for closeCurrentClockSet , I set that property to NO . Therefore, it should no longer appear on my tableView. For Some Reason, this is not happening. Can someone help me figure this out please? -(void)closeCurrentClockSet { NSPredicate * predicate = [NSPredicate predicateWithFormat:@"isOpen == YES"]; NSArray *fetchedObjects = [self fetchRequestForEntity:@"ClockSet" withPredicate:predicate inManagedObjectContext:[myAppDelegate managedObjectContext]]; ClockSet *currentClockSet = (ClockSet *)fetchedObjects

NSPredicate: filtering objects by day of NSDate property

谁都会走 提交于 2019-11-26 19:24:22
I have a Core Data model with an NSDate property. I want to filter the database by day. I assume the solution will involve an NSPredicate , but I'm not sure how to put it all together. I know how to compare the day of two NSDate s using NSDateComponents and NSCalendar , but how do I filter it with an NSPredicate ? Perhaps I need to create a category on my NSManagedObject subclass that can return a bare date with just the year, month and day. Then I could compare that in an NSPredicate . Is this your recommendation, or is there something simpler? Given a NSDate * startDate and endDate and a

Core Data nested managed object contexts and frequent deadlocks / freezes

允我心安 提交于 2019-11-26 19:09:11
问题 I have a problem that is almost identical to the problem described by this person here, but it hasn't get answered: http://www.cocoabuilder.com/archive/cocoa/312683-core-data-nested-managed-object-contexts-and-frequent-deadlocks.html#312683 Here is the problem: I have a parent MOC setup with NSPrivateQueueConcurrencyType and a persistent store coordinator set, it has a child MOC setup with NSMainQueueConcurrencyType. The idea being most of the long hard work and saves can be done on the

Is there a way to instantiate a NSManagedObject without inserting it?

℡╲_俬逩灬. 提交于 2019-11-26 18:52:06
问题 I have a user interface to insert a Transaction. once the user clicks on a plus he gets the screen and i want to instantiate my Core Data NSManagedObject entity let the user work on it. Then when the user clicks on the Save button i will call the save function. so down to code: transaction = (Transaction *)[NSEntityDescription insertNewObjectForEntityForName:@"Transaction" inManagedObjectContext:self.managedObjectContext]; //even if i dont call save: its going to show up on my table [self

Can you do custom animations for UITableView Cell Inserts?

不羁的心 提交于 2019-11-26 17:58:26
问题 I've got a UITableView that is being populated by an NSFetchedResultsController. On the initial load of the table I would like the Cells to be animated in but I would like to do a little bit more custom animation than [tableView insertRowsAtIndexPaths:withRowAnimation:]; Allows. Specifically I would like to slow down the animations and have them fly in from the side in a specific way. I have not been able to achieve this by UITableViewRowAnimation constants. Is there a way to use Core