nsfetchedresultscontroller

NSFetchedResultsController and Tables using Relationships

随声附和 提交于 2019-12-11 10:03:31
问题 As a simple example lets say I have 2 entities with a many to many relationship. The first entity is called "Projects" and the second "Employees". The project entity can have 1 or more employees and employees can be on one or more projects. Again for simplicity Project has an attribute called projectName and a to many relationship with Employee called withEmployees. Conversely Employee has employeeName and a to many relationship to projects called myProjects. Using NSFetchedResultsController

NSFetchedResultsController sort by first name or last name

风格不统一 提交于 2019-12-11 10:03:27
问题 I am basically trying to achieve NSSortDescriptor with first name and last name,or with either first name or last name? but with an NSFetchedResultsController. I am reading records from the address book and want to display them just like the Address Book does. The records will be sorted into sections based on first letter of last name. If there isn't a last name it will sort by first name and if there isn't a first name it will sort by company. Currently I have - (NSFetchedResultsController *

Deleting a row in tableview without deleting Core Data Entity

痞子三分冷 提交于 2019-12-11 08:38:55
问题 I have a table view backed by NSFetchedResultsController. The situation is as follows. I have implemented "swipe to delete" a row. Delegate methods of NSFetchedResultsController and those of table view's are called. But the thing is, I don't want to delete a Core Data Entity, I just want to mark its boolean flag since I need this entity in other parts of application, and want table view to delete row with animation. However, according to error messages it is against logic like if you are

NSFetchedResultsController objectAtIndexPath crash (EXC_BAD_ACCESS)

匆匆过客 提交于 2019-12-11 07:41:58
问题 I have a huge problem with NSFetchedResultsCOntroller. I'm using fetchedResultsContrioller and I have interface with 3 tabs. They use Core Data too. But I have a problem with only ONE of them. Faktura *faktura = [self.fetchedResultsController objectAtIndexPath:indexPath]; cell.textLabel.text = faktura.NumerFV; // THE CRASH IS HERE int productsCount = [faktura.Produkty count]; // OR HERE NSString *kontrahentName = [faktura.Kontrahent valueForKey:@"NazwaKrotka"]; // OR HERE cell.detailTextLabel

sectionIndexTitlesForTableView keys are off?

家住魔仙堡 提交于 2019-12-11 04:44:45
问题 I have implemented a Section Index for my tableview. It returns the correct letters for what is stored in coredata ( A B C D F G H I K M N O P Q R S T U V W ). However the indexes are off. If I click on the letter M it takes me to letter I, etc.. The name of the index I am attempting to sort on is name What is there for me to do to fix the index? I am also implementing numberOfSectionsInTableView , numberOfRowsInSection , and titeForHeaderInSection . The section headers are displayed

How to use NSFetchedResultsController to generate sections after dates

无人久伴 提交于 2019-12-11 03:44:26
问题 I am presenting a list of managed objects where each has a timeStamp property. I want to sort the list chronologically using the timeStamp property which i do with a NSSortDescriptor. But I also want to generate sections based on whole dates (one section for every day) The following will give me one section based on second-differences which is too many sections: NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest

NSFetchedResultsController doesn't always call didChangeObject:atIndexPath:forChangeType:newIndexPath: for NSFetchedResultsChangeMove

怎甘沉沦 提交于 2019-12-11 03:37:16
问题 I'm using NSFetchedResultsController with sortDescriptors on the request to populate a table with a lot of results in it. I notice that when a change occurs that moves a row from near the bottom of the table to the top, didChangeObject:atIndexPath:forChangeType:newIndexPath: is not called at all. Strangely, I can work around this by iterating through all the fetched objects and accessing any attribute on them right after calling performFetch . Any tips on what the problem might be, or is this

iOS: NSFetchedResultsController, ControllerDidChangeContent executed twice after reordering

人盡茶涼 提交于 2019-12-11 02:55:21
问题 Have started before a similar thread, but I now know where the problem lies, so I'm narrowing it down for you: I have two view controllers. First one is called MainCategoriesViewController , 2nd one is NetIncomeViewController . Both are child of my CoreDataViewController . In the CoreDataViewController I basically just have implemented all delegate methods of the NSFetchedResultsController delegate class with a property which is set if user changes occur (like reordering) and the controller

Method for moving rows with NSFetchedResultsController and its delegate not working

那年仲夏 提交于 2019-12-11 02:46:41
问题 I've been trying to follow this tutorial for rearranging rows in a table view while using NSFetchedResultsController and NSFetchedResultsController delegate, but my project is extremely buggy. What happens is that when I try rearranging a row and drop it, the rows are randomised (probably not randomised, but I can't see the pattern to find the problem). What's wrong with my implementation? Table view data source: override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:

Using a NSFetchedResultsController with an NSManagedObject and fetched properties

淺唱寂寞╮ 提交于 2019-12-11 02:45:46
问题 I have a database of Card s and Printing s that I have in one store (reference data) and my user's data of Container s and CardInstance s in another store (as Apple suggests). Each user's card is a table CardInstance that contains a specific printingID that corresponds with a specific printing of a card. I'm trying to use a NSFetchedResultsController to filter the values of the cards so that it can manage the groupings and stuff using reusable code. Again, here's the basic overview of the