core-data

How to delete all data in CoreData?

Is there a quick way to clear all data of my CoreData without calling deleteObject for each entity in the model? ...

Is there a way of sharing a Core Data store between processes?

What am I trying to do? A UI process that reads data from a Core Data store on disk. It wouldn't need to edit the data, just read and display the data. A command line process that writes to the same data store as accessed by the UI. Why? So that the command line process can be running all the time but the user can quit the UI proce...

Core Data with in-memory store

I want to use Core Data as a cache for a larger dataset on a database server. Not all data will be in memory. When thinking about this further 2 questions came to mind: Can faulting (for example for 1-n relationships) be used with the in-memory persistent store, and if so, how do you a catch a fault firing? A Core data managed object...

Best implementation for iTunes-like playlist structure?

I'm creating an app that has a master-detail interface, similar to iTunes. It has the same data hierarchy as iTunes' playlists (except that I'm not allowing groups of "playlists" to keep things simple). In other words, there are normal playlists where their only items are added manually by the user. There are smart playlists, which sh...

Core Data: re-setting to-many relationship

Hi, I have created model which you can see there: http://i.imagehost.org/0836/2009-11-08%5F14%5F37%5F41.png I want to store information about sound categories and some sample sounds for each category. Category has Name (NSString) and SoundsRelation (NSSet of NSData, which represents sounds). Here is the problem: For example I have som...

Calculating sum for decimal values via Core Data not working properly?

Hi everyone, first time I post to this round, so please bear with me if I don't follow all the rules properly. I am writing an app for the iPhone (OS 3.1) and am trying to write some code which lets me add decimals. I have a Core Data entity called SimpleItem with a amount attribute. Here is the test case I wrote: // Create and config...

Core Data: multiple entities related to a single entity

I have an entity called 'SyncInfo' (including a UUID and a modified date) that I want other entities in my data model to have an instance of (i.e. employee/department). Is there a simple way to get Core Data to allow me to do this without requiring that SyncInfo have relationships with every single one of the other entities in the data ...

Implementing parent->child drill down in Cocoa with Core Data bindings that span multiple entities

I'm trying to create a simple interface to my core data model in the style of iTunes Genre browser. I have a model setup with three entities: Genre <-->> Artist <-->> Album. I'd like to simply tie them each to a NSTableView, but it appears as though accessing children relationships from a NSArrayController is not KVC compliant. So, I'...

How to set modification date every time NSManagedObject changes?

Every time one of my managed objects is modified, I want to store the date it was modified (in an attribute which is already in my data model), for convenience when I'm syncing with other clients. Is there a way to do this without A) re-writing all my setters manually or B) relying on myself to always change the modification date every ...

Core Data / Cocoa : @distinctUnionOfObjects not returning a usable NSArray*

Hi there, I have an application that uses Core Data that has a relationship that I would like to group by. I have NSManagedObject classes that were generated by my .xcdatamodel file, and everything seems to be working OK for the most part. Given a parent / child relationship, I would like to do the following: A parent has a collection ...

Is there a bulk update operation for all entities in Core Data?

On the iPhone, Does Core Data have a way to bulk update a field for every instance of an entity that it's storing? Something like update some_entities set some_count = 0 where some_count > 0 Or do I just have to instantiate every entity, set the value, then save it? (And if that's the answer, how could I do that in a single transacti...

Core Data: Generate Unique ID Number

Hi all, I have a window that looks like so: Everytime a record is added, I want the repair ID to be set to a unique number that hasn't been used in the table yet. e.g. if there is ID numbers 1,2,3, then when I press +, the ID field should be set to '4'. Also, if one of the records in the table is deleted, so that the ID numbers are: ...

iPhone UITableView populated by checked Table Cells. How?

I came upon this blog post the other day and literally have no idea how to implement it, logically. Any ideas? I was thinking it involves core data, with 'power' being another entity in a to-many relationship, besides that, I'm lost. ...

Primary Key behaviour in Core Data iPhone

I am making an app that parses feeds from xml and stores them using Core Data. The issue I am dealing with at the moment is duplicate entries. Every feed I am parsing contains a unique id, something that I get in my model as an int. Now what I need is to tell Core Data not to store that entity if another with the same id already exists. ...

core data in a static library for the iPhone

I've built a static library that makes heavy use of the Core Data framework. I can successfully use the library in my external project, but ONLY if I include the .xcdatamodel file in the main project. That is less than ideal, since the point of the library was to hide implementation details to the maximum possible. In a separate questio...

Cocoa Core Data newbie how-tos

Hi everyone, I am one of the great unwashed masses of .NET developers keen to try their hands at Mac OS X development. At the moment I am trying to figure out the various elements of Cocoa and getting a bit stuck on Core Data. I noticed most of the documentation and resources available on the Web involve a broad end-to-end tutorial, be...

CoreDataGeneratedAccessors - removeObject does delete the object ?

When I generate my classes from CoreData entities I get generated methods @interface Site (CoreDataGeneratedAccessors) - (void)addSearchesObject:(Search *)value; - (void)removeSearchesObject:(Search *)value; - (void)addSearches:(NSSet *)value; - (void)removeSearches:(NSSet *)value; @end So my question is pretty simple when I call rem...

Changing the Sorting in an NSFetchedResultsController on the fly

I'm trying to change the sorting in a NSFetchController on the fly, by some sort of segmented control. To either sort A->Z Z->A type thing. What do I have to do to do this? I'm following Jeff Lamarche's example here: Here Do I need to make a new NSFetchedResultsController and then set it, or do I just make a new NSFetchRequest and do ...

Prefilling Core Data for a read-only application

Hello all, i am working on an application that displays read-only data i am shipping. it is more of a book. It is easy with SQLite but i am not satisfied with the performance and trying to use Core Data. The issue is with pre-filling Core Data is that it is a hard process. My question is: Is it possible to build an assistant iphone a...

How do I find the size of my Core Data persistent store and the free space on the file system?

I am working on a database application using the Core Data framework. In this application I need to display how much data the application currently is using on the iPhone. Is there any way to do this? ...