nsfetchedresultscontroller

Update old/new top/bottom cells' backgroundView when inserting/deleting top/bottom cells

為{幸葍}努か 提交于 2019-12-12 12:21:45
问题 This is the template code given in the doc of NSFetchedResultsControllerDelegate : - (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { [self.tableView beginUpdates]; } - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type { switch(type) { case NSFetchedResultsChangeInsert: [self.tableView insertSections:[NSIndexSet

Core Data error when deleting row in tableView

人走茶凉 提交于 2019-12-12 12:14:06
问题 I have a UITableViewController managing a grouped tableView. The tableView is populated from a fetchedResultsController. If I click the Edit button in the NavigationBar, then select a row and click the Delete button, the row is deleted and all ends well. However, if I swipe to reveal the Delete button in a row and click the Delete button, the app crashes with the following error: 2010-01-06 15:25:18.720 Take10[14415:20b] Serious application error. Exception was caught during Core Data change

Force NSFetchedResultsController update when association count changes

谁都会走 提交于 2019-12-12 11:35:29
问题 I have an NSFetchedResultsController which displays a list of items in a table view, including a count of an associated entity. When an object is added for this association (using addXXXObject), no callbacks are called to notify my controller of the update. How can I receive a notification of an object being added to the parent entity's NSSet, or otherwise force the fetched results controller to update? To be clear, I'm currently retrieving the count using parent.children.count, which may be

sectionNameKeyPath with NSFetchedResultsController not working

左心房为你撑大大i 提交于 2019-12-12 10:36:56
问题 I have an entity Order with property paid , which is a boolean. I want to display all orders in a UITableView , but I want to group them in two sections: 'Not Paid' and 'Paid'. So I thought I'd just give "paid" as sectionNameKeyPath , like this: fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"paid" cacheName:nil]; According to my reasoning, this would result in two sections, where

Serious application error. Model object getting NSFetchedResultsController message

随声附和 提交于 2019-12-12 10:18:51
问题 I have a very odd error with Core Data . I have a Recipe class that has a many to many relationship to an Ingredient class. When I try to add an Ingredient to the Recipe on a RecipeViewController , everything works fine until I save the context. Thats when things go horribly wrong. I get an error on my RecipesTableViewController (which has a NSFetchedResultsController and implements NSFetchedResultsControllerDelegate ). The - (void)controllerWillChangeContent:(NSFetchedResultsController *

working with a NSFetchedResult controller and section headers for each month [duplicate]

♀尐吖头ヾ 提交于 2019-12-12 06:47:50
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Setting a different section for each month with fetchedresultcontroller I am trying to split my UITableview into sections for each month. I start working with the DateSectionTitles example of apple. First of all I added in my coredata a attribute 'sectionIdentifier'. Then in my managedobject subclass I added this method. - (NSString *)sectionIdentifier { // Create and cache the section identifier on demand.

How to check inserted and deleted items in UICollectionView, seeing unexpected deleted item

流过昼夜 提交于 2019-12-12 05:26:12
问题 I am struggling to integrate UICollectionView and NSFetchedResultsControllerDelegate in this particular case. In my view controller, I fetch a Parent entity, but display its multiple Child entities in the collection view. When creating a new Parent entity in this view controller (with insertNewObjectForEntityForName ) and automatically creating a Child entity and adding it to the parent entity with addChildObject , I can add more Child entities by pressing a button, and save the object

Enhance my Core Data design. Experts only!

三世轮回 提交于 2019-12-12 05:19:17
问题 In AcaniUsers, I'm downloading the closest 20 users to me and displaying their profile pictures as thumbnails in a table view. User & Photo are both Resources because they each have an id (MongoDB BSON ObjectId) on the server. Each user has a unique_id. Each Photo has four different sizes (images) on the server: square: 75x75, square@2x: 150x150, large: 320x480, large@2x: 640x960. But, each device will only have two of these sizes, depending on whether it's an iPhone 3 or 4 (retina display).

How to know the last cell of the UITableView which is populating from a coredata?

这一生的挚爱 提交于 2019-12-12 04:15:03
问题 I am using a UITableview with core data.I am calling api and storing data in my local db.Using fetchedResultsController table is getting displayed. From server paginated data is coming each time 20-30 items.So if I reached last cell while scrolling the tableView I should call the api again to get the next items. This is my fetchedResultsController - (NSFetchedResultsController *)fetchedResultsController { if (! _fetchedResultsController) { NSFetchRequest *fetchRequest = [[NSFetchRequest alloc

NSFetchedResultsController can't performFetch when sorted attributes aren't all the same

不问归期 提交于 2019-12-12 04:10:11
问题 I have a strange issue with an NSFetchedResultsController that can only handle performFetch when all the entity.number s are the same number (this NSFetchedResultsController sorts the entities using number . This is kind of like a playlist that uses an indexNumber attribute to keep the playlist order. - (IBAction)addSetPressed { int theNumber = [self.nameTextField.text intValue]; WSet *set = [WSet wSetWithNumber:theNumber inManagedObjectContext:self.workout.managedObjectContext]; [self