Questions tagged [nsfetchedresultscontroller]

An Apple fetched results controller is used to efficiently manage the results returned from a Core Data fetch request to provide data usually for a UITableView or UICollectionView object. It is available in iOS 3.0 and later.

An Apple controller used to efficiently manage the results returned from a Core Data () fetch request to provide data for a UITableView or UICollectionView object.

From Apple Official NSFetchedResultsController Document, fetched results controllers provide the following features:

  • Optionally monitor changes to objects in the associated managed object context, and report changes in the results set to its delegate (see: The Controller’s Delegate).

  • Optionally cache the results of its computation so that if the same data is subsequently re-displayed, the work does not have to be repeated (see: The Cache).

Example:

NSFetchedResultsController *controller = [[NSFetchedResultsController alloc]
    initWithFetchRequest:fetchRequest
    managedObjectContext:context
    sectionNameKeyPath:nil
    cacheName:@"<#Cache name#>"];

[fetchRequest release];

Questions in Stack overflow related coredata

  1. Good tutorials or good for using Core.Data in IOS 7

  2. JSON and Core Data on the iPhone

  3. Why use NSFetchedResultsController?

2287 questions
0
votes
1 answer

Passing NSFetchedResultsController between UIViewControllers

I have 3 different view controllers that present same data. Basically they are presented one after another. They are presenting same entity that is fetched with NSFetchedResultsController. I am now pondering since these are same…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
0
votes
2 answers

UITableView wrong section titles

I have been stuck on this error for quite some time now. I have a UITabBar with 2 tabs. The first one contains a UITableViewController with meals on different dates of the week. The second tab contains a UIViewController with a login screen. The…
Emptyless
  • 2,964
  • 3
  • 20
  • 30
0
votes
1 answer

NSFetchedResultsController: no object at index 2147483647

Need a hint, give up after spending several hours struggling with NSFetchedResultsController. The error message is: CoreData: error: NSFetchedResultsController: no object at index 2147483647 in section at index 0 ...but I don't even know who is…
danilabagroff
  • 602
  • 1
  • 7
  • 23
0
votes
2 answers

NSFetchedResultsController update when relationship updates?

Imagine I have a data model that has 2 entities: Movie and Genre. A Movie can belong to many Genres, as a Genre can have many Movies. Now. I want to have a NSFetchedResultsController that observes the Genre entity (using the genre's name as a…
horseshoe7
  • 2,745
  • 2
  • 35
  • 49
0
votes
1 answer

NSFetchedResultsController with non unique section name

I am initialising NSFetchedResultsController with following code self.fetchedResultsController = NSFetchedResultsController( fetchRequest: request, managedObjectContext: context, sectionNameKeyPath:…
0
votes
1 answer

NSFetchedResultsController - grouping results from a single entity

Let's say that my Core Data model contains the following entity, Family: I'd like to use NSFetchedResultsController to display the contents of the Family in a UITableViewController in the following format where parents are "sections" with children…
Vee
  • 1,821
  • 3
  • 36
  • 60
0
votes
1 answer

Fetch from Core Data sorted by formatted date

I am having trouble fetching results from Core Data that are sorted by date. I have a DB table that contains football matches. Each match has a homeTeam, awayTeam and kickoffTime. The kickoffTime is an NSDate that stores the date and time the match…
0
votes
1 answer

2 UITableViews inside 1 UIViewController both loading from CoreData

I'm attempting to have 2 separate UITableViews inside of 1 UIViewController, but the trick is that I'm trying to do it so they both load from CoreDate. I was trying to accomplish it by using the same style I would with UITableViewController, but I…
0
votes
1 answer

I am using FRC to display random pairs on my tableview

I am able to separate my persons objects into arrays of 2 randomly but I can't figure out how to display the pairs on my tableview. Here is my randomizer function. func randomizer(array: [Person]) { guard let array =…
0
votes
1 answer

Deleting CoreData objects causes FetchedResultsController to error

I'm using the Big Nerd Ranch BNRCoreDataStack, but I suspect that this problem would exist if I was using standard CoreData. I have a FetchedResultsController to populate my table by fetching NSManagedObjects. These are being rendered in sections…
Lee Probert
  • 10,308
  • 8
  • 43
  • 70
0
votes
2 answers

iOS - UITableView add single static cell to dynamic table

I Have a UITableView which is controlled by NSFetchedResultsController. I want to add single cell to the first row and make this cell static. In other words, there will be a button which will open another View Controller. Until now, I was ok with…
0
votes
1 answer

How to restrict FetchedResultsController to objects in a given day

I am trying to create a UITableView that populates with objects for a selected date (specifically yesterday, today, and tomorrow) . In my CoreData model, the entity in question as a property date with typeDate`. To get yesterday, today, and tomorrow…
jjatie
  • 5,152
  • 5
  • 34
  • 56
0
votes
1 answer

UITableView Section Header Behavior iOS 9.X vs 10.x

I am having an issue where my tableView:viewForHeaderSection: is being called a different amount of times in IOS 9.X VS 10.X. In 9 it only gets called once(which is incorrect) while in 10 it gets called for all the correct sections I have set in the…
0
votes
3 answers

Changing computed property in swift

I'm having NSFetchedResultsController as lazy computed property. Based on a variable, sort descriptor is created. Here's my code: private var sortOption: Options = .none fileprivate lazy var inspirationsResults:…
Satyam
  • 15,493
  • 31
  • 131
  • 244
0
votes
0 answers

Syncing table view with Fetch Result controller using core data

I have a test case where I insert 100 items into a managed context. In another contact I have a fetch result controller where it updates a table view. When the insert call back comes from fetch result controller, I use self.tableView.insertRows(at:…
1 2 3
99
100