nsfetchedresultscontroller

Showing duplicate cells in UITableView via NSFetchedResultsController?

孤者浪人 提交于 2019-12-10 12:19:30
问题 I am querying Core Data to find the "OLDEST" and "HEAVIEST" amongst a group of people. With a larger dataset this usually works (as the chance of a duplicate match is less), but with a small dataset where the OLDEST person may also be the HEAVIEST I am having problems. [John, 77, 160] [Pete, 56, 155] [Jane, 19, 130] [Fred, 27, 159] [Jill, 32, 128] As I want to display this information in 2 UITableViewCell s of a UITableView I am doing this by first running 2 NSFetchRequests (one to find the

NSFetchedResultsChangeDelete not being triggered

混江龙づ霸主 提交于 2019-12-10 10:04:10
问题 Has anyone run into this before? When I choose to delete a row from my tableView (populated by an FRC), the app doesn't crash or hang. It doesn't do anything. The delete button stays selected and if I click elsewhere on the simulator, the delete button deselects and disappears, but the cell is never removed form the UI. I'm sure there is a dumb oversight I am making here, but I can't spot it. Below are the relevant portions of my code. I have my UITableViewController interface declared as

UICollectionView with Multiple subclassed UICollectionViewCell

孤街浪徒 提交于 2019-12-09 15:37:23
问题 I have multiple sections in my UICollectionView grouped by "datasetType". I also have a custom UICollectionViewCell for each section. How can I determine which custom UICollectionViewCell I need in the cellForItemAtIndexPath method? My first though was go to based of the [sectionInfo name] : id sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:indexPath.section]; if ([[sectionInfo name] isEqualToString:@"DatasetA"]) { DatasetACell *datasetACell = [collectionView

Delete row in table view with fetchedResultController

只愿长相守 提交于 2019-12-09 14:50:00
问题 During swype deleting (most importatnt lines of this method): - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { Table *deleteRow = [self.fetchedResultsController objectAtIndexPath:indexPath]; [self.managedObjectContext deleteObject:deleteRow]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation

NSFetchedResultsController doesn't see new inserts / removes fetched values after update

人盡茶涼 提交于 2019-12-09 09:28:37
问题 After reading dozens of similar questions, I'd like to start with this statement: "I DID set the delegate of the NSFetchedResultsController, it didn't work.". So I have a simple TableViewController whose cells are filled with NSFetchedResultsController. Here's the FRC init code: @property (strong, nonatomic) NSFetchedResultsController *frc; ... - (NSFetchedResultsController *)frc { if (!_frc) { NSError *error = nil; NSFetchRequest *request = [[NSFetchRequest alloc] initWithEntityName:e

NSPredicate, get results with a subset of one-to-many relationship

十年热恋 提交于 2019-12-09 01:41:13
问题 I'mm working around with Core Data and NSFetchedResultsController . My Data Model looks like this: Product with one-to-many relationship called dataLines . The dataLine entity has a property name theWeek . I want to fetch all Product where dataLines.theWeek == someValue . This is easily done with a subquery. But this returns all dataLines. Is it possible to create a NSPredicate that returns the Product and a subset if dataLines only with the dataLines == someValue ? 回答1: What you want to

The fetched object at index [i] has an out of order section name 'å

 ̄綄美尐妖づ 提交于 2019-12-08 13:35:55
问题 Error fetching: Error Domain=NSCocoaErrorDomain Code=134060 "The operation couldn’t be completed. (Cocoa error 134060.)" UserInfo=0x132eb960 {reason=The fetched object at index 76 has an out of order section name 'å. Objects must be sorted by section name'} I checked and there are other questions with the same name, however in this case the problem appears due to diacritic alphabet symbols. - (NSFetchedResultsController *)fetchedResultsControllerWithPredicate: (NSPredicate *)aPredicate {

Core Data + NSFetchedResultsController in SWIFT

*爱你&永不变心* 提交于 2019-12-08 11:20:26
问题 I will try to make it as simple as possible i am fetching from core data using NSFetchedResultsController my cellForRowAtIndexPath looks like this override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell? { var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell let newEntry : Entry = fetchedResultController.objectAtIndexPath(indexPath) as Entry cell.textLabel.text = newEntry.title

NSFetchedResultsController Crash

不想你离开。 提交于 2019-12-08 08:59:21
问题 Following steps result in a crash in NSFetchedResultsController. I try to add the first element to a NSFetchedResultsController backed TableView. I create a temporary MO object and display a Modal View pane to add new object. On the Add Sheet (a Modal View Controller), I press Cancel Button to discard the new element. In the CancelAction callback for Cancel button, I delete the new temporary object I created. The code till here is exactly similar to Apple sample code for Core Data. The only

Needed clarifications for NSFetchedResultsController and NSFetchedResultsControllerDelegate

谁说胖子不能爱 提交于 2019-12-08 08:02:01
问题 Within SO there are a lot of questions/replies about NSFetchedResultsController and delegate. Sometimes the delegate fires, sometimes not. And since Core Data is quite complex argument is quite difficult to understand what is going on without spending a lot of time on it. In addition, the documentations says that there are several problems but it does not list them. There are several known issues and behavior changes with NSFetchedResultsController on various releases of iOS. Hence, I need