nsfetchedresultscontrolle

How to control UISearchDisplayController's own table view?

In my application, when I am not filtering my table, when I tap on a cell, its frame height is increased in order to display a UIProgressView that shows download progress. However, when I filter the fetched results controller data with a UISearchDisplayController, the cells in this filtered table view do not behave in the same way. In...

Objective-C: [sectionInfo name] of NSFetchedResultsSectionInfo needs to be dateFormatted

Hi guys, I have the following code: -(NSString *)tableView:(UITableView *)table titleForHeaderInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchedResultsController sections] objectAtIndex:section]; NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDat...

NSPredicate: filtering objects by day of NSDate property

I have a Core Data model with an NSDate property. I want to filter the database by day. I assume the solution will involve an NSPredicate, but I'm not sure how to put it all together. I know how to compare the day of two NSDates using NSDateComponents and NSCalendar, but how do I filter it with an NSPredicate? Perhaps I need to create ...

NSFetchedResultsController not updating UITableView's section indexes

I am populating a UITableViewController with an NSFetchedResultsController with results creating sections that populate section headers and a section index. I am using the following method to populate the section index: - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return [fetchedResultsController_ sectionIn...

Core Data error when deleting row in tableView

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 bu...

UISearchBar's TableView doesn't seem to update correctly...

I'm having a problem with using UISearchBar in a UITableView application, where the list is not refreshing itself correctly and the item that is at the index "0" remains the same. Here is some images to demonstrate what is happening: In the first image, I have begun to search a list of names, and the two that show up beginning with 'a' ...

How to use NSFetchedResultsController to support managing data on UITableView like iPhone Photo app.

I am a beginner for iPhone development, I use core data as backed store and show multiple data entities on UITableView. Each data entity will be show as a preview thumbnail, one table view cell will hold 1 to 4 thumbnail. That's means 3 table cells may show at most 12 data entities, just like iPhone Photo. I also need operate to each of...

NSFetchedResultsController for map annotations

The documentation for the NSFetchedResultsController states that it is intended for use to 'efficiently manage the results returned from a Core Data fetch request to provide data for a UITableView object'. Could I use an NSFetchedResultsController to manage a collection of map annotations as well? I am not sure how I would do this. Any ...

Application crashes on second select of same row

Hi all, I've run into a problem with an iPhone core data application that I'm working on. I have a table that lists objects. If I select one of those objects, I go to a new ViewController that shows the detail for the object. In the detail view, I have a back button that takes me back to the main list view. I can select any number of...

Core Data NSFetchedResultsController - Total number of records returned

Hello, I'm using an NSFetchedResultsController in an iPhone app, and am wondering if there is some easy way of getting the total number of rows returned in all sections. Instead of getting the [[fetchedResultsController sections] count] and then looping through each section to get its count, can it be done in one line? Thanks! ...

Why is NSFetchedResultsController not correctly loading section titles?

I am using NSFetchedResultsController along with a UITableViewController. I've created a transient field in my Core Data model to use as a label for my UITableView sections. The name of the field is "sectionIndex". In my application, a "Client" entity has many "Jobs" (1 to many) - so my query to retrieve Jobs groups them (via section) b...

Core Data: communicating extra context to objects fetched with NSFetchedResultsController ?

I'm using NSFetchedResultsController pretty much out-of-box in the way that the documentation describes. Here is an excerpt of my code. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"SomeEntity" inManagedObjectCont...

NSFetchedResultsController not showing updates from other contexts

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 b...

Core Data Table View Section Sort by weekdays using NSSortDescriptor

I'm currently trying to sort my array of objects into day order so they can be grouped in the correct order i.e. Monday, Tuesday, Wednesday then by start time. Only problem is I can't figure out how to do this, my code currently looks like this: Which sorts alphabetically then by time: NSString *sectionKey = nil; switch (tab) { case k...

How to implement delayed/batched table view update from NSFetchedResultsControllerDelegate?

The documentation says: You should consider carefully whether you want to update the table view as each change is made. If a large number of modifications are made simultaneously—for example, if you are reading data from a background thread— /.../ you could just implement controllerDidChangeContent: (which is sent to the delegate whe...

One NSFetchedResultsController vs several UITableViews — only one UITableView gets updates?

Setup: I have several UITableViewControllers (tvc) that all instantiate a separate NSFetchedResultsController (frc). All these frc-s, though, use the same ManagedObjectContext (moc). Scenario: Sometimes, from one of the tvc-s, I launch some background process to update data. The background process updates the data in a separate thread...

How to use NSFetchedResultsController and UISearchDisplayController

Hey! I've been creating an iPhone App using Core Data. First of all, does it make sense to use an NSFetchedResultsController and a UISearchDisplayController together to fetch the result? Would you recommend something else? I've been trying quite long combining an NSFetchedResultController and a UISearchDisplayController. I've been thi...

Fixing predicated NSFetchedResultsController/NSFetchRequest performance with SQLite backend?

I have a series of NSFetchedResultsControllers powering some table views, and their performance on device was abysmal, on the order of seconds. Since it all runs on main thread, it's blocking my app at startup, which is not great. I investigated and turns out the predicate is the problem: NSPredicate *somePredicate = [NSPredicate predi...

NSFetchedResultController and UISearchBar implementation

Hey! I'm creating a simple Navigation-based app using core data for my iPhone and I'm trying to implement a little search. The app is baed on the "Navigation-based application"-template from Apple. The NSFetchedResultsController gets all the objects and they will be displayed in the table view. I've also have left the Plus button to add...

Multi-property "transactions" in Core Data / NSManagedObject / NSFetchedResultsController?

Hi, Is it possible to set multiple properties of an NSManagedObject and have the NSFetchedResultsController call controllerDidChangeContent: only once? In other words, is it possible to say something like: [managedObject beginChanges]; [managedObject setPropertyA:@"Foo"]; [managedObject setPropertyB:@"Bar"]; [managedObject commitChang...