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
2 answers

UITableView with multiple NSFetchedResultsControllers causing Assertion failure

I have a UITableView with 3 sections and each section is being fed through unique NSFetchedResultsController. I am getting Assertion failure from the NSFetchedResultsController -controllerDidChangeContent, when inserting, updating...the table. My…
Peter Pajchl
  • 2,699
  • 21
  • 24
0
votes
1 answer

fetchedresults won't display rows contents, only titleforheaders and rowsinSection in UITableView

I can't figure out how come the row count is correct but the uitableview won't load the row contents the NSLog shows carresults=(null), but the row count is correct, on the simulator if I relaunch, the carresults get filled. It seems like I'm…
0
votes
1 answer

NSFetchedResultController crash when setting delegate Swift 4, iOS 10+

I have a very strange crash when inserting data from an HTTP Request into CoreData with a backgroundContext using the new: persistentContainer.performBackgroundTask({ (context) in }) My code is the following:…
0
votes
1 answer

How to detect when all controllerDidChangeContent methods finished

I'm using NSfetchedResultsController. I need to send an update to CloudKit when all controllerDidChangeContent methods finished. In my case controllerDidChangeContent method called several times, because I receive updates of every record in my…
Adelmaer
  • 2,209
  • 3
  • 22
  • 45
0
votes
0 answers

NSFetchedResultsController returns duplicates

I parse JSON file, than I create new objects in Core Data managed context. At this point everything is ok, I get all valid objects. But when I try to renew data at tableView using NSFetchedResultsControllerDelegate method something goes wrong-…
D. Pass
  • 83
  • 9
0
votes
0 answers

Ensuring that FetchedResultsController matches its linked TableView after MOC save

TLDR - my FRC appears to get out of sync with the table view it is linked to. How can I get it to sync? My View Controller (VC) has a table view called holesTable that is managed by a fetched results controller (FRC) called…
0
votes
1 answer

How to objects from a fetchedResultsController to a Plist?

Can someone help me. I have a coredata application but I need to save the objects from a fetchedResultsController into an NSDictionary to be used for sending UILocalNotifications. Should I use an NSMutableSet, or a NSDictionary, or an array. I'm not…
Miky Mike
  • 341
  • 6
  • 17
0
votes
1 answer

setFetchBatchSize Fetching all the rows in messages Table

Following is my code snippet. NSSortDescriptor *sortSequence = [[NSSortDescriptor alloc] initWithKey:@"date_added" ascending:YES]; NSArray *sortDescriptors =[NSArray arrayWithObjects:sortSequence,nil];…
Jeff
  • 1,405
  • 3
  • 26
  • 46
0
votes
1 answer

Observe to sectionNameKeyPath changes when from relationship

What is the best practice to ensure changes to the sectionKeyPathName values (which are from a related entity) are propagated to the UITableView's section headers (includes redrawing the section headers with the new value and changing the section…
AgRizzo
  • 5,261
  • 1
  • 13
  • 28
0
votes
0 answers

fetchedResultsController Error - fatal error in code

Thanks for considering to help me! so I am getting this error in the console, How should I start going about fixing it? *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An instance of NSFetchedResultsController…
0
votes
0 answers

CoreData error: (FetchedResultsController.getter).(closure #1)

Hi I am getting an Error with (FetchedResultsController.getter).(closure #1) the point of the error is let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext:…
P S
  • 527
  • 4
  • 18
0
votes
1 answer

FRC populates TableView but FetchedResultsControllerDelegate methods not working

I have a View Controller, called ScorecardViewController, that contains a UITableView, called HolesTable, which is correctly populated by a FetchedResultsController. However, when the user edits any data, none of the FRC delegate methods are called…
Dave
  • 71
  • 10
0
votes
1 answer

How to filter NSFetchedResultsController with relationship - Swift 3

I am using NSFetchedResultsController to display data in a table view. I have 2 objects, Client, and Formula. A Client can have many Formulas but a Formula can have just one Client, so a one-to-many relationship. When I tap on a certain Client in a…
0
votes
1 answer

NSFetchresultsController multiple predicate

I have one CoreData model object that includes a type named sessionID (a uuid generated every time the user uses a feature in the app) - data keep coming in and recorded with the same sessionID for each session. The recorded data would look like…
Koen
  • 49
  • 1
  • 6
0
votes
1 answer

Is it possible to create NSFetchedResultsController to fetch all entities with distinct values for specific property?

Suppose I have Person entity with properties: id, name, age: And I have following records: 101, Katherine, 23 102, Madelaine, 23 103, Katherine, 27 104, Vicky, 18 105, Kirsten, 45 106, Vicky, 12 And I need all records sorted by age, without…
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358