nsfetchedresultscontroller

CoreStore refetch predicate NSFetchRequest issue

邮差的信 提交于 2020-01-25 09:34:07
问题 if I got it clear I need to refetch monitor when I search something: I have this function to refetch with provided string func search(searchText: String) { self.monitor.refetch(.where(format: "%K CONTAINS[cd] %@", #keyPath(ListEntityType.name), searchText), OrderBy<ListEntityType>(.ascending("name"))) } but this code is not compilable, only this below: func search(searchText: String) { self.monitor.refetch(Where<ListEntityType>("name", isEqualTo: searchText), OrderBy<ListEntityType>(

Core Data / NSFetchedResultsController - Registering changed objects related to the fetched object

ⅰ亾dé卋堺 提交于 2020-01-24 19:43:05
问题 I use a NSFetchedResultsController to get a list of objects which is displayed in a UITableView . If I change values in the objects the whole thing triggers and automatically reloads the changed rows. But one of the displayed values comes from related objects (one-to many relationship). Those objects have a transient title (so it's value comes again from another object). When this title changes the rows are not reloaded. Question: Can anybody suggest a clean solution to this? Possible Dirty

Efficient way to update table section headers using Core Data entities?

天大地大妈咪最大 提交于 2020-01-24 09:44:05
问题 Im using a NSFetchedResultsController for my UITableView which displays a bunch of events im storing in core data. What i am trying to do is group the table by relative date (ie Today, Tomorrow, This Week, etc..). Each event has a start date and i tried creating a transient property in the event entity called sectionIdentifier which converts the date into a relative date as mentioned above like so: - (NSString*)sectionIdentifier { [self willAccessValueForKey:@"sectionIdentifier"]; NSString

CoreData performFetch in viewDidLoad not working

和自甴很熟 提交于 2020-01-23 11:08:06
问题 When my main view controller is loaded and it calls viewDidLoad I am performing a fetch request and retiring an array or my core data objects: + (NSArray *)getData { // Fetch Data NSError *error = nil; if (![[[AppDelegate instance] fetchedResultsController] performFetch:&error]) { // Update to handle the error appropriately. NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } NSArray *items = [[AppDelegate instance].fetchedResultsController fetchedObjects]; return items; }/

CoreData performFetch in viewDidLoad not working

荒凉一梦 提交于 2020-01-23 11:05:43
问题 When my main view controller is loaded and it calls viewDidLoad I am performing a fetch request and retiring an array or my core data objects: + (NSArray *)getData { // Fetch Data NSError *error = nil; if (![[[AppDelegate instance] fetchedResultsController] performFetch:&error]) { // Update to handle the error appropriately. NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } NSArray *items = [[AppDelegate instance].fetchedResultsController fetchedObjects]; return items; }/

coredata error because sectionNameKeyPath or grouping data at NSFetchedResultsController

北城余情 提交于 2020-01-23 07:57:58
问题 2011-12-28 10:52:13.633 BadgerNew[663:707] CoreData: error: (NSFetchedResultsController) object <Business: 0x628c8e0> (entity: Business; id: 0x628c870 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/Business/p88> ; data: { Aliases = "<relationship fault: 0x6219950 'Aliases'>"; Bookmark = 0; Building = nil; City = "0x56531a0 <x-coredata://8D661026-BBFA-4C41-B434-167800D925DD/City/p1>"; Distance = "104.6926812925746"; Districts = ( "0x63bcb30 <x-coredata://8D661026-BBFA-4C41-B434

Magical Record, saving, and NSFetchedResultsController

对着背影说爱祢 提交于 2020-01-22 12:27:36
问题 Not sure if this is an issue with the way Magical Record does saves, or I'm just making an noob mistake somewhere. I'm using an NSFetchedResultController (FRC) and UITableView to display a list of entities, when the user taps "Add" a new View Controller with an editor is pushed, a new entity is created with [MyEntity MR_createEntity] . The user can add additional entities here that are added to the main entity via a relationship. When the user taps "Save" in this View Controller the context

Matt Gallagher's UITableView (Revisited) + NSFetchedResultsController

一世执手 提交于 2020-01-22 04:45:46
问题 If you look at Matt Gallagher's Cocoa With Love blog, he has a brilliant discussion (with sample code) on a fresh a beautiful retake on UITableView ... In the post, he talks about it's great many benefits of animations and heterogeneous cells, etc. However, one of the limitations he lists is a bit of a show-stopper for me. It won't work with NSFetchedResultsController. The design of loading data into the cells assumes that all that data is static and available immediately. However, if you are

numberOfRowsInSection: method for core data and multiple sections

假如想象 提交于 2020-01-19 13:09:10
问题 I am trying to show a table view with 2 sections. The first section will always have 1 row and the second section will have as many rows as data points. I am using Core Data and the following tableView:numberOfRowsInSection: method... - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { return 1; } else { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo

numberOfRowsInSection: method for core data and multiple sections

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-19 13:08:09
问题 I am trying to show a table view with 2 sections. The first section will always have 1 row and the second section will have as many rows as data points. I am using Core Data and the following tableView:numberOfRowsInSection: method... - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { return 1; } else { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo