core-data

NSFetchedResultsController crashes on every save operation

Even when I commented out every single activity within the delegate methods, every time I call an "managedobjectcontext save:nil" operation, the app crashes with different erros namely the following: (seems like a release problem but not sure where. I get EXC_BAD_ACCESS) #0 0x02813a93 in objc_msgSend #1 0xbfffd5b0 in ?? #2 0x0236c1b...

NSFetchedResultsController: should I always check fetchedObjects==nil before calling -performFetch?

I'm using NSFetchedResultsController for my table view. I call -performFetch inside my controller's -viewDidLoad method. Sometimes my controller gets unloaded and then re-loaded, resulting in another call to -viewDidLoad and -performFetch. I found that this was causing an error: "NSFetchedResultsController error: section '(null)' not fo...

Core Data - Optional attributes and performance

Per the Core Data Programming Guide: You can specify that an attribute is optional—that is, it is not required to have a value. In general, however, you are discouraged from doing so—especially for numeric values (typically you can get better results using a mandatory attribute with a default value—in the model—of 0). T...

Core Data, UITableView, and UISegmentedControl

Hello, I am new to working with Core Data, and am working with a UITableView. I have a toolbar with a UISegmentedController, and I want to filter the items in the UITableView based on the selected index. In other words, suppose I have a UITableView that displays Books (stored in Core Data) and a UISegmentedController with segments to ...

NSFetchedResultsController predicate is a little too real time...?

So I've got an NSFetchedResultsController that I activate on ViewDidLoad with the managedobjectcontext that has been passed on from the appdelegate on load. I put a predicate on some field let's call it "sectionNumber" and say it needs to equal 1 in my predicate. NSFetchResultsController works fine until I add a new object to the MOCon...

Core Data: When and where are Entities loaded in the first Place?

Hello experts, I have a question about Core Data. When starting my appliction, when is my data (which is stored automatically by Core Data) loaded into the NSArrayControllers? I want to modify it in the first place before the user can interact with it. To be more specific: I have an NSArrayController for the entitity Playlist. Before t...

Predicate and distinct objects

I have entity Unit and Tag, each with to-many relation to other. I am using NSFetchedResultsController to manage the data. What I need is to return distinct Unit object into NSFetchedResultsController for condition Tag.show == YES. I'm not sure how to feed all this to NSFetchedResultsController. Set entity to Unit or Tag, how to build ...

Fetched Results Controller with NSPredicate vs. Core Data NSSet

Okay, so I have a UITableView hierarchy. The top level controller is for Categories, which are selected via Fetched Results Controller with no predicate for the Category Entity. When a user taps a cell, they are advanced to the Items Table View Controller. At this point, I assumed I should use another fetched results controller with an...

What is an inverse relationship in CoreData

Hi, I am using CoreData but I don't think I got the inverse relationship concept right. Could any one explain what is it? Let's say I have a "File" entity with "files" relationship and "parentFile" relationship "File" entity has: a to-many relationship "files" with itself ("File"). a to-one relationship "parentFile" with itself ("Fil...

NSPredicate string matching against NSSet's

I'm trying to use an NSPredicate to search for string matches against an array of CoreData objects generated like so: // Grab an array of all Company projects NSArray *array = [[company projects] allObjects]; I use the following predicate to match any project names, company names or client names with a case-insensitive string (note: t...

Coredata: Strategy Pattern Implementation

I'm trying to implement the Strategy pattern using Core Data and Objective C. To simplify, I have, say, a multilingual Text entity, which has several attributes, such as a Date for last saved, and a NSSString for author etc etc. I want to add a reference to a Language entity, which could be one of several subclasses, such as French, Ita...

How do you save CoreData with UIPickerView and then load CoreData with UITableView?

I have a multiview application using a tab bar to switch views. One is a pickerview while the other two are a table view and a view with 4 text fields (and one other table view that just contains instructions on how to use the app). I want to use core data to save selected rows in the picker view and also save strings that are entered in...

Core data save triggered a non relevant exception about UICalloutBarOverlay????

2010-08-05 00:34:49.186 Holidays[30485:207] -[UICalloutBarOverlay controllerWillChangeContent:]: unrecognized selector sent to instance 0x5b53540 2010-08-05 00:34:49.188 Holidays[30485:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICalloutBarOverlay controllerWillChangeContent:]: unrecognize...

CoreDataGeneratedAccessors not generating automatic selectors

Hello All, I am currently working on an App which uses core data. I tried specifying CoreDataGeneratedAccessors in the interace itself, but accessors like setName do not seem to be automatically generated. Is this something wrong with my XCODE configuartion? Thanks, Jith. ...

Is Core Data more suitable than SQLite for server client database design?

I'm having a server client database design which I'm unsure is Core Data suitable? I have a server database which will maintain the master copy of the data and their relationship. Each client application will have an empty client database with only relationship. Upon the start up of the client, it will request for data from the server...

How do I set up an NSPredicate that filters for items in a specified group using NSFetchedResultsController

I have a Group entity which has many Item entities. An Item entity can be in multiple groups. The relevant portion of my model looks like this: The Problem When I call [fetchedResultsController performFetch:&error] I get this error in the console *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ...

How to model a HPC queueing system with Objective-C

I am trying to program an application for the mac to query a high performance computing cluster about its running and queued calculation jobs. The aim is to be able to monitor the submitted jobs if they are still queued and waiting for execution or if they are running and on which node or host in the cluster. On the GUI side I would lik...

NSManagedObject property managedObjectContext has no value

In my code, I am trying to access [NSManagedObject managedObjectContext] but surprisingly it returns nil. The managed object is loaded because I already successfully accessed it's values using [NSManagedObject valueForKey:]. Is there any case where managedObjectContext returns nil? ...

use custom core data persistent store for getting data via webservices?

Is this a good idea? When is it a good idea, and when is it bad? Just heard about this in one of the WWDC videos, and I don't quite understand why would one want to do it this way. Seems complicated and I cannot see the benefit. ...

NSPredicate filter the data via relationship rather than a property

Here is my question. I have this model one [Event] has multiple [Day] and there is a relationship called days in [Event] and there is a reverse relationship event in [Day]. Now I want pass the Event object and get all days using NSFetchedResultsController and feed all days in the table. Here is my code: // Create the fetch request for ...