nsfetchedresultscontroller

NSFetchedResultsController: Fetch in a background thread

旧时模样 提交于 2019-11-27 16:30:52
问题 I have a more or less basic UITableViewController with a NSFetchedResultsController . The UITableViewController is pushed onto the navigationController's stack. But the push animation isn't smooth because the fetch of NSFetchedResultsController is performed on the main thread, and therefore blocks the UI. My question is: How can I perform the fetch of the NSFetchedResultsController in a background thread to keep the animation smooth? The NSFetchedResultsController and the delegate methods

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no object at index 3 in section at index 0'

被刻印的时光 ゝ 提交于 2019-11-27 11:21:06
问题 Hi I'm having a hard time fixing this error. Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no object at index 3 in section at index 0' That error exist when I delete all my Entity in coredata and refetch it. CALL API self.fetchedResultsController = nil; [NSFetchedResultsController deleteCacheWithName:nil]; [api requestForMenuCategory:@"details" managedObjectContext:self.managedObjectContext delegate:self]; EXECUTE WHEN API IS DONT FETCHING DATA if (!

Can you do custom animations for UITableView Cell Inserts?

爷,独闯天下 提交于 2019-11-27 10:52:55
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 Animation to do exactly what I want or do I need to stick with UIKit animations in this specific instance?

Implementing Fast and Efficient Core Data Import on iOS 5

你。 提交于 2019-11-27 05:46:01
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 incrementally. It's got to be invisible and imperceptible to the user that large amounts of data are

iOS 9 - “attempt to delete and reload the same index path”

半世苍凉 提交于 2019-11-27 05:16:18
问题 This is an error: CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. attempt to delete and reload the same index path ( {length = 2, path = 0 - 0}) with userInfo (null) This is my typical NSFetchedResultsControllerDelegate : func controllerWillChangeContent(controller: NSFetchedResultsController) { tableView.beginUpdates() } func controller(controller: NSFetchedResultsController,

Sorting on 'transient' fields with NSFetchedresultController

◇◆丶佛笑我妖孽 提交于 2019-11-27 04:42:08
问题 Is there a way to use a 'transient' field or something like that and in some way sort accordingly with a NSFetchedResultsController. I want to do the following: I have location of places in a database. When a person opens the list, I want to show the nearest place on top, an then sort accordingly to distance. But clearly,this depends on the users location, so I cannot use a static field. I was hoping to use a transient field, as you can use for the section headers. Is there anybody who can

NSRangeException exception in NSFetchedResultsChangeUpdate event of NSFetchedResultsController

不羁岁月 提交于 2019-11-27 04:35:17
问题 I have a UITableView that uses an NSFetchedResultsController as data source. The core data store is updated in multiple background threads running in parallel (each thread using it's own NSManagedObjectContext ). The main thread observes the NSManagedObjectContextDidSaveNotification notification and updates it's context with mergeChangesFromContextDidSaveNotification: . Sometimes it happens that the NSFetchedResultsController sends an NSFetchedResultsChangeUpdate event with an indexPath that

Core Data NSPredicate with to-Many Relationship

北城余情 提交于 2019-11-27 04:35:14
问题 I have two Entities in CoreData called User and Coupon, they are in Many-to-Many relationship. I wanted to fetch for all Coupons except those owned by user.userId = 1, where userId is NSString. I used: [NSPredicate predicateWithFormat:@"NOT(ANY couponOwners.userId = %@)", @"4"]; to be the predicate of my fetchedResultsController but not filtering with correct results. One of the User in couponOwners of the Coupon is still having userId = 4. Could somebody please help? I have been stuck for

NSFetchRequest and predicateWithBlock

纵饮孤独 提交于 2019-11-27 04:13:49
I am playing with an app that uses Core Data and NSManagedObjects to populate a UITableView. There is only one class in my application, called Event . I have created the following custom instance method on Event : - (BOOL)isExpired { return ([[self.endOn dateAtEndOfDay] timeIntervalSinceNow] < 0); } I would like to limit the UITableView that displays Event objects to only the Events that are expired - that is, where isExpired returns YES . I have tried to do this by adding an NSPredicate to the NSFetchRequest : NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject,

A NSFetchedResultsController with date as sectionNameKeyPath

北慕城南 提交于 2019-11-27 03:54:09
I develop an application which uses Core Data. In one UITableView, I want to display a list of my entities, sorted by the saved date of the objects. When I do this: fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"date" cacheName:nil]; I get for each object a new section because this code groups the dates according to the seconds, too. But I want a list of the objects, grouped by date, but only according to the day, month and year. Is it possible and how? Thank you very much for your