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

IOS/Objective-C:Rearrange Table Cells with FetchedResults Controller

I am trying to follow this Ray Wenderlich tutorial that lets you rearrange tablecells where the datasource is an NSArray: It uses the exchangeObjectAtIndexPath.row withObjectAtIndex:sourceIndexPath.row method to rearrange the data behind the…
user6631314
  • 1,751
  • 1
  • 13
  • 44
0
votes
1 answer

Threaded Core Data & UINavigationController

I have an app that uses Core Data in background. Every time when i push some view controller, starts background thread which loading data from server and fills it to core data. Every view controller uses NSFetchedResultsController for realtime table…
ruffnecktsk
  • 211
  • 1
  • 2
  • 4
0
votes
1 answer

Swift3 CoreData - fetchResultsController

I get this error : ItinerariesCodeChallenge[2594:1022206] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An instance of NSFetchedResultsController requires a fetch request with sort descriptorsHere's my code.…
0
votes
0 answers

NSFetchedResultsController: How to set fallback value incase text set for `sectionNameKeyPath` doesn't exist

SCENARIO I am using a NSFetchedResultsController to display information to my user in a UITableView. This information is highly dynamic with objects being added and removed often. When I am setting the NSFetchedResultsController I would like to…
Brandon A
  • 8,153
  • 3
  • 42
  • 77
0
votes
1 answer

Filter NSFetchResultsController with NSPredicate using slider

I'm a beginner iOS developer (this is actually my first attempt at an iOS app). The app I'm making is supposed to display pollution levels on a map. What I would like is to set a slider and display the pollution levels for a certain time based on…
Lukasz
  • 2,257
  • 3
  • 26
  • 44
0
votes
1 answer

NSFetchedResultsController adds item in wrong indexPath

I wrote simple counters app. It uses CoreData to store data. In model I have one entity named "Counter" with attributes "value" (Int64) and "position"(Int16). Second attribute is position in tableView. User can add, delete or increase counter. I…
0
votes
1 answer

Custom sort in iOS, want to show default(All Group) title on top from Coredata

I am using core data with NSFetchedResultController. In this case, I have an n number of user groups and a user can select a particular group or select all group. So manually I added All group title, static ID and relevant content to the…
0
votes
1 answer

What is the best way to implement shorting(Multiple time on single data) and filter with core data with Swift 3?

[Core data provides NSFetchResultController to help with UITableView. I want to sort data with Duration, Depart, Arrival, Price, and Number of stops with ascending and descending orders. I con sort data by providing sort descriptor to fetch…
0
votes
2 answers

Updates to core data object from SyncTable pull, not calling NSFeatchedResults delegate methods

I am using NSFetchedResultsController to track and load UITableView with two sections(based on available true or false) using data from coredata entity. Coredata entity is populated by azure syncTable pull method. I call…
0
votes
1 answer

How can I sort a UITableView by a value that's calculated when a UITableViewCell is created?

I have a UITableView in my app that shows a long list of NSManagedObjects of type LiftEvent that are in an NSFetchedResultsController. One of the values displayed, however, isn't a stored property, it's calculated by calling a method on the object…
Jim
  • 1,260
  • 15
  • 37
0
votes
1 answer

TableView with NSFetchedResultsController is Flickering so much

I got a tableView with FRC. I use NSMergeByPropertyObjectTrumpMergePolicy as mergePolicy for managedContext save. The problem is when a record updated "didChange" delegate method is calling 3 times. It's calling for in that order insert, delete,…
0
votes
1 answer

NSFetchedResultsController's sections array element's name not updating correctly

I've got a simple usage of NSFetchedResultsController defined something like this contrived example let request: NSFetchRequest = StudentEntity.fetchRequest() request.sortDescriptors = [ NSSortDescriptor(key: "class.name",…
jimbobuk
  • 1,211
  • 12
  • 25
0
votes
0 answers

Updating an Existing Core Data Entry

Hi fellow developers, I have an app in its early stages utilising Core Data. The premise is simple: Add in restaurants, save it to Core Data and display it. So I have an AddEntry with a bunch of textFields - the user fills those in, clicks Save…
amitsbajaj
  • 1,304
  • 1
  • 24
  • 59
0
votes
1 answer

Calling a Core Data attribute through a relationship

I have two Entities as depicted in the image below: Food and Restaurant. I know the naming is a bit off for now, but basically, I'm building up a list of Food items. A user will add in a new entry with the name of the food and the name of the…
0
votes
0 answers

cannot convert value of type 'Task' to expected argument type 'Coursework'

Okay so I am having an issue with my fetch results controller. The issue seems to be that when asking it to pull data from another table an exception occurs where it seems to be trying to convert one table into the other. Why is this? var…
Joel
  • 1