nsfetchedresultscontroller

Custom Section Name Crashing NSFetchedResultsController

痴心易碎 提交于 2019-12-04 01:48:49
问题 I have a managed object with a dueDate attribute. Instead of displaying using some ugly date string as the section headers of my UITableView I created a transient attribute called "category" and defined it like so: - (NSString*)category { [self willAccessValueForKey:@"category"]; NSString* categoryName; if ([self isOverdue]) { categoryName = @"Overdue"; } else if ([self.finishedDate != nil]) { categoryName = @"Done"; } else { categoryName = @"In Progress"; } [self didAccessValueForKey:@

Delete row in table view with fetchedResultController

◇◆丶佛笑我妖孽 提交于 2019-12-04 00:30:38
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:UITableViewRowAnimationFade]; } } When deleting row I get this error: Terminating app due to uncaught exception

Serious Application Error in Core Data with fetchedResultsContainer

我是研究僧i 提交于 2019-12-03 22:37:35
I get the following error when trying to add a record: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. The index 0 is invalid with userInfo (null) And that's it. I put breakpoints into all the fetchedResultsContainer delegate methods I have implemented, but nothing breaks. I tracked it down to: NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext

NSFetchedResultsController swift sections

扶醉桌前 提交于 2019-12-03 22:08:27
问题 I have a table view that takes data from a CoreData entity with 3 fields. firstName: String, lastName: String and done:NSNumber (which is a UISwitch that can be turned ON or OFF). I want to populate the table with the first and last names but first section is with names having the Switch ON, and a second section with names having the Switch OFF. here is the code that saves the data: class ViewController: UIViewController { var context = (UIApplication.sharedApplication().delegate as!

NSFetchedResultsController is driving me crazy

╄→尐↘猪︶ㄣ 提交于 2019-12-03 21:58:30
i've been building an app since 1 month using NSFetchedResultsController and i was testing the app on the 3.1.2 SDK. The poblem is that i've been using NSFetchedResultsController everywhere in my app and was working on the 3.1.2 version of the SDK, now my client say that i should make it compatible with the 3.0 version and the deadline is almost there. But is crashing everytime i change an object handled by the contoller, the application is crashing with very weird errors. The problem occure when removing the last object in a section and when a change make an object love to another section. I

How to jump to the next row in detailview

喜欢而已 提交于 2019-12-03 21:37:07
i have a TableView which loads a detailview in didSelectRow. I have no problems with the data's. I am using coreData and to populate the TableView i am using a NSFetchedResultsController. Now, i want to make a next and previous function in the detailView to jump to the next or previous Table(row) Element . Next Previous like in the Mail-App. I know that i have to use a button with IBAction. But how can i make this function? thanks, brush51 Edit 1: I have it done so: - (IBAction) previousCard:(id) sender { NSLog(@"previousBtn"); DashboardViewController *parent = (DashboardViewController *)self

NSFetchedResultsController is not showing all results after merging an `NSManagedObjectContextDidSaveNotification`

坚强是说给别人听的谎言 提交于 2019-12-03 19:40:37
问题 I have an NSFetchedResultsController which fetches objects with a predicate: isTrash == NO Most of the time this works as expected, but when an object gets untrashed the fetched results controller does not fetch the untrashed object. What's going wrong? 回答1: The reason why this is happening is due to how mergeChangesFromContextDidSaveNotification: handles updated objects. NSManagedObjectContext keeps a record of objects which are in use in the context, these are referred to as registered

'NSFetchedResultsController does not support both change tracking and fetch request's with NSDictionaryResultType'

只愿长相守 提交于 2019-12-03 19:11:37
问题 I have an application that was running just fine under OS3+. But it does not work under OS4. I get the following error message: 'NSFetchedResultsController does not support both change tracking and fetch request's with NSDictionaryResultType' Does it ring a bell to anyone here? - (NSFetchedResultsController *)fetchedResultsController { if (fetchedResultsController != nil) { return fetchedResultsController; } /* Set up the fetched results controller. */ // Create the fetch request for the

Core Data Fetched Results Controller and Custom Section Header

非 Y 不嫁゛ 提交于 2019-12-03 16:55:21
I am familiar with the common and basic use of a NSFetchedResultsController managing the rows of a table, but I have an interesting problem. My data is organized as such: Schedule <--->> Day <--->> Route. I currently have a table view that has Schedules with a fetch controller managing the creation and deletion of Schedules. I now want to create a table view for Routes/Days. I would like to list a Route on every row, and create custom section headers that correspond to information within the relevant Day. I could probably hack something together by fetching all the routes, and then sectioning

NSFetchedResultsController not showing updates from other contexts

被刻印的时光 ゝ 提交于 2019-12-03 16:03:38
I have an NSFetchedResultsController set up to populate a UITableView, based off my 'main' NSManagedObjectContext. In a timer, I continually add objects into a separate NSManagedObjectContext, but one that shares its NSPersistantStoreCoordinator with the main context. I can see NSManagedObjectContextWillSaveNotification notifications being sent, and when I quit an restart the app, I have all the data from the previous run. However, no updates happen to the current NSFetchedResultsController. I've created a test project and placed it here . (I initially thought this was happening due to there