nsfetchedresultscontroller

NSFetchedResultsController with relationship not updating

核能气质少年 提交于 2019-11-26 17:45:29
Let's say I have two entities, employee and department. A department has a to-many relationship with employee, many employees can be in each department but each employee only belongs to one department. I want to display all of the employees in a tableview sorted by data that is a property of the department they belong to using an NSFetchedResultsController. The problem is that I want my table to update when a department object receives changes just like it does if the regular properties of employee change, but the FetchedResultsController doesn't seem to track related objects. I've gotten

Implementing Fast and Efficient Core Data Import on iOS 5

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 11:44:28
问题 Question : How do I get my child context to see changes persisted on the parent context so that they trigger my NSFetchedResultsController to update the UI? Here\'s the setup: You\'ve got an app that downloads and adds lots of XML data (about 2 million records, each roughly the size of a normal paragraph of text) The .sqlite file becomes about 500 MB in size. Adding this content into Core Data takes time, but you want the user to be able to use the app while the data loads into the data store

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

拜拜、爱过 提交于 2019-11-26 07:27:38
问题 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

NSPredicate: filtering objects by day of NSDate property

北战南征 提交于 2019-11-26 06:55:59
问题 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

NSFetchedResultsController with predicate ignores changes merged from different NSManagedObjectContext

 ̄綄美尐妖づ 提交于 2019-11-26 05:53:43
问题 I am presenting table view contents using NSFetchedResultsController which has a predicate: [NSPredicate predicateWithFormat:@\"visible == %@\", [NSNumber numberWithBool:YES]] On background thread using separate NSManagedObjectContext I update few of the entities and change theirs visible value from NO to YES . Save, merge changes in main thread\'s NSManagedObjectContext . But NSFetchedResultsController \'s fetchedObjects doesn\'t change. Also controller doesn\'t call -controller