nsfetchedresultscontrolle

Force NSFetchedResultsController update when association count changes

I have an NSFetchedResultsController which displays a list of items in a table view, including a count of an associated entity. When an object is added for this association (using addXXXObject), no callbacks are called to notify my controller of the update. How can I receive a notification of an object being added to the parent entity's...

Sort on to-many relationship using a NSFetchedResultsController

I'm trying to use the NSFetchedResultsController in my app, but have a problem to sort my data. I get the following error when trying to sort the result using a relationship that is two levels down from the entity: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'to-many key not allowed here' M...

Core Data sorting in one to many relationship

I have setup a data model where Student Entity has a name a 1-to-many relationship with Subject. Each Subject that he attends has a number of Class Times. The code below sorts it, based on the Student name, this is straight forward. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Student" inManagedObjectContext:...

Is there a way to instantiate a NSManagedObject without inserting it ?

This is an iPhone dev question about CoreData. I have a user interface to insert a Transaction. once the user clicks on a plus he gets the screen and i want to instantiate my Core Data NSManagedObject entity let the user work on it. Then when the user clicks on the Save button i will call the save function. so down to code: transa...

How can I refresh a NSFetchedResultsController?

I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler plate code provided by Xcode when choosing to create a Core Data project. I added the following predicate to the NSFetchRequest the NSFetchedResultsController uses (before NSFetchedResultsController is initialized): NSPredicate *predicate = [N...

How to create a new NSFetchedResultsController using an NSManagedObject as a filter.

I am trying to figure out how to set up a new NSFetchedResultsController. Here are the steps I am taking: NSFetchedResultsController retrieves grandparent objects, which I will call "Sets" Show them up in a UITableView. Select cell. Pass selected "Set" NSManagedObject to new view controller. THIS IS WHERE I NEED HELP. I want the vie...

Core Data: sorting by count in a to-many relationship

I am currently trying to setup a NSFetchedResultsController that will order my table view based on the number of entities in a to-many relationship. I am not sure if this makes a difference when counting, but this is also an inverse relationship. I thought something like this would work just fine: NSEntityDescription *entity = [NSEntit...

NSFetchedResultsController with predicate ignores changes merged from different NSManagedObjectContext

I am presenting table view contents using NSFetchedResultsController which has a predicate: [NSPredicate predicateWithFormat:@"visible == %@", [NSNumber numberWithBool:YES]] On background thread using separate NSManagedObjectContext I update few of the entities and change theirs visible value from NO to YES. Save, merge changes in mai...

NSFetchedResultsController with NSURLConnection

I have a User class and want to display many users' thumbnails w/ their name overlayed & a green dot overlayed if they're online, etc. in a grid-like tableView (like Grindr, similar to iPhone's Camera Roll). First, I fetch a JSON array of user data for the nearest (geographically) 20 users from the server. Then, I parse the JSON and ins...

Serious Application Error in Core Data with fetchedResultsContainer

Hi there, 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 breakpoi...

When is viewDidLoad called?

Is it safe to assume that an attribute, namely fetchedResultsController, of chatViewController, an instance of a subclass of UITableViewController, is always nil when viewDidLoad is called, assuming that it's set to nil in viewDidUnload? Phew! If that's the case, then I see no immediate need to redefine the accessor function like in the...

NSFetchedResultsSectionInfo disagrees with itself about how many objects it has

I posted this on the Apple dev forums here since it feels to me like a bug in the actual SDK, but I thought I'd post it here as well and see if anyone could verify whether or not I'm using this thing incorrectly (doesn't seem like it) or this is broken behaviour. https://devforums.apple.com/thread/72738 -- After spending a little whil...

NSFetchedResultsController delegate methods not firing after mergeChangesFromContextDidSaveNotification

Hi, Been browsing through the posts similar to this one but none answered my problem. Like CoreDataBooks, I use a separate MOC for adding and editing items and observe the proper notifications, like so: - (void)addControllerContextDidSave:(NSNotification*)saveNotification { NSManagedObjectContext *context = [self.fetchedResultsCont...

iphone Core Data - Filtering NSFetchedResultController?

I was given a framework written by other programmers to access the core data. In this situation i receive a pre-loaded NSFetchedResultController which I need to filter, to display a part of it's data. Here is what I tried: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"category==%@", @"current"]; [NSFetchedResultsControlle...

NSFetchedResultsController and UITableViewCell

I have a UITableViewController fetching a collection of objects A with a NSFetchedResultsController. This works well and if these objet A's properties are updated, the UITableViewCell for A reflects the change. The problem: this object has a relationship A->[B1, B2, B3...]. The cell is using some of the B's properties in its display. ...

Reflect changes to objects in a relationship in parent object with NSFetchedResultsController

Hello all, I have two entities event and time. The event entity has a 1 to many relationship to time entities as each event can be performed multiple times. Now I want to display all the events chronologically in a tableView. So I set up a fetchedResultsController to fetch all time objects, sort them according to the start time and disp...

Can't Release NSFetchedResultsController in dealloc

I have two UITableViewControllers with a fairly simple ui flow. One UITableViewController loads another UITableViewController when you select an item in the first UITableViewController. (UITableViewController) List of Stories -> Select a Story -> (UITableViewController) List of Sentences In the second UITableViewController (MakeSen...

Can I use NSFetchedResultsController for the display of data not meant for a UITableView?

In the FRC documentation, it says that it is intended to efficiently manage the results returned from a Core Data fetch request to provide data for a UITableView object. I am trying to setup my Core Data stack to handle the storage and retrieval of some VERY basic data. Can I not use FRC? I need to display a value set in the db to a UIL...

NSFetchedResultsController delegate methods won't be called after rearranging table rows

hi all i wonder why the delegate methods of NSFetchedResultsController won't be called after i reorder table rows. my problem is that rows disappear when i rearrange them in my tableview with the method - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath so ...