core-data

NSManagedObject get parent object

I have an NSManagedObject who has a one to many relationship with the parent Object. How can I get the parent object using the child object? ...

Modifying existing object attributes in Core Data after the fact

In a previous question, I was looking for an alternative to modifying how "no date" was being stored in the date attribute of my NSManagedObject subclass. Previously, I had assigned nil to that attribute when a user didn't assign a date. In order to address sorting issues when using NSFetchedResultsController, I have decided to assign ...

Binding Many-to-Many Core Data relationships in UI

Basically my setup is this. I have a many-to-many relationship in Core Data where a student entity can have multiple courses, and a course entity can have multiple students. My problem is in trying to figure out how to bind this relationship to the UI in Interface Builder. I want to be able to add courses to a course array controller, t...

core data editor problems

I was recommended by someone in Stack Overflow to use Core Data Editor http://christian-kienle.de/CoreDataEditor/ to manage the sqlite persistent store. However the latest version (3.0) crashes on launch everytime. Older versions load but I see nothing when i point the config to the persistent store and the object model directories. Ther...

Does anyone know how to populate the picker controller with core data

Hi guys, I'm trying to populate the UIPicker with Core Data instead of an array but can't for the life of me figure out how to do it... Please can someone point me in the right direction as to what I can do as I'm completely stuck... Thanx a lot Stef :-) ...

NSPredicate acting strange in NSFetchedResultsController

I feel as if this should be very simple, but it's behaving strangely. I have 3 entities, with a relationship as such Entity A <-->> Entity B <<--> Entity C I have an NSFetchedResults controller and I'm trying to filter the results of Entity A using the following predicate. [NSPredicate predicateWithFormat:@"NONE entityB.entityC == %@...

iPhone Development - Using NSPredicate to retrieve most recently added record from CoreData

I want to retrieve the most recently added record from CoreData. I was wondering if that's possible using NSPredicate? If so, how? e.g. i have a one-to-many relationship between Department and Staff, and i want to fetch the Staff record that was most recently employed. The Staff table has a date field which can be used. I don't want t...

UITableView crashes when adding 2 objects to an empty store, with sections (NSRangeException)

UITableView crashes in endUpdate, called by the Managed Object Context "save" method, when: 1- The Core-Data Store is empty 2- The Fetched Result Controller is configured to show sections 3- Two managed objects (or more) have been added to the store When I've searched this problem in google. I've found exactly matched error in this p...

inserting new relationship data in core-data

My app will allow users to create a personalised list of events from a large list of events. I have a table view which simply displays these events, tapping on one of them takes the user to the event details view, which has a button "add to my events". In this detailed view I own the original event object, retrieved via an NSFetchedResu...

How do I get a new version of a xcdatamodel to appear in xcode?

Environment: xcode 3.2.1, document-based core-data application. I have a document-based cocoa app which uses core data. I have made multiple versions of the data model Xcode shows a xcdatamodeld directory with multiple xcdatamodels (versions) that I made over time. (I also have the appropriate mapping models). All works fine, but now wh...

Appending data to NSFetchedResultsController during find or create loop

I have a table view that is managed by an NSFetchedResultsController. I am having an issue with a find-or-create operation, however. When the user hits the bottom of my table view, I am querying my server for another batch of content. If it doesn't exist in the local cache, we create it and store it. If it does exist, however, I want...

How to set a reference from one object to another?

SOLVED I misspelled the property department -> Department. Thanks for the answers and a big SORRY Hi, Imagine the obvious model of employees and departments, where each employee must refer to a single department, and each department may have none to many employees. For Employee I have a pointer to Department, and I set its value to ...

iPhone Development - CoreData runtime error

I'm facing a strange CoreData issue. Here's the log: 2010-04-07 15:59:36.913 MyProject[263:207] <MyEntity: 0x180370> (entity: MyEntity; id: 0x17e890 <x-coredata://0F55C533-41BD-4F09-9CCA-0CB304CAB065/MyEntity/p380> ; data: <fault>) 2010-04-07 15:59:36.918 MyProject[263:207] *** Terminating app due to uncaught exception 'NSObjectInaccess...

Saving core data in a thread, how to ensure its done writing before quitting?

So I'm saving small images to core data which take a really short amount of time to save, like .2 seconds but I'm doing it while the user is flipping through a scroll view so in order to improve responsiveness I'm moving the saving to a thread. This works great, everything gets saved and the app is responsive. However, there is one thi...

Core Data iPad/iPhone BLOBS vs File system for 20k PDFs

I'm designing an iPad/iPhone app using core data. The main focus of the app is sorting and viewing up to 20,000 PDFs They are ~200KB each. Typically its best to not store BLOBS in a DB, but for desktop systems I've typically seen it said that if the blobs are < 1 MB then its fine to use the DB. Any considerations I should take into count...

Core Data (NSFetchedResultsController) displaying one row per section

I have a CoreData application which uses NSFetchedResultsController. NSFetchedResultsController is useful in that it allows me to access the fetched objects more easily etc. but I find that I have problems with the following: I get a crash when I display a single row for each section (irrespective of the number of actual rows present) a...

How do I get Core Data to create an SQLite DB from my Managed Object Model

I've been strungling with Core Data. I've looked at the examples and documentation but they all seem to copy an existing SQLite DB into the working directory. I've defined my data model and just want Core Data to create a SQLite DB. I then will populate the db im my app. Can anyone show me how? ...

How do you clean Core Data generated models and code from a project?

I'm having an extremely annoying problem with Core Data in the iPhone SDK. I would say in general Core Data for the most part appears easy to use and nice to implement. I have a sqlite database that is being used as a read only reference to pull data elements out for an iPhone app. It would seem there are really mysterious issues relati...

Core data, threads saving to a persistant store w/out locking, whats could go wrong?

My application downloads and caches photos into coreData in background threads while still allowing the user to poke around in the application. Currently after a photo's data is done downloading I start a thread to save it to coredata using the suggested shared storeCoordinator and thread-owned context then merge on the main thread, I a...

CoreData is saving model without the save: method being called

I have a list of items with a plus button in the navigation bar that opens up a modal window containing a table of the models attributes, that displays a form when the table items are clicked (pretty standard form style). For some reason if I click the plus button to open the form to create a new model, then immediately click the done b...