core-data

NSArrayController selection

Hello, I want to achieve the following: There is a list of persons (name, birthday, photo) I want to select a person name in the NSPopUpButton and show other details below. How can I do it using bindings only? I use NSArrayController to populate NSPopUpButton. I use NSArrayController.selection. to populate birthday and photo fields. B...

Implementing Transient Properties

Hello all, I am adding a transient property to my Core Data-based app, and I think I am missing something. In the Data Model Editor, I added a optional, transient, BOOL property called isUnderwater. In my model's header file, I added: @property (nonatomic) BOOL isUnderwater;, then I implemented these methods in the implementation file...

Core Data on iPhone and Performance

I'm trying to import a large amount of data into a core data store on the iPhone. I'm using a SQLite backing for the core data store. It seems to be taking way longer than I would expect it to. I've trimmed down the routines so that it is basically just attempting to a fetch an object (to see if it already exists) and then create a new o...

UITableView grouping sections

I have a UITableView that's populated using core data & sqlite. I'd like to have sections grouped in the UITableView based on an attribute from the database table. e.g If i had a category field in the database table called "type", what would be the best way of sectioning that data out? I've seen examples using arrays, but I'm getting...

Arbitrary Attributes in Core Data

In short, I want to associate arbitrary key/value pairs with the objects of a Core Data entity, on an iPad app. My current solution is to have a to-many relationship with another entity that represents a single pair. In my application, I have: Entry <--->> ExtraAttribute where ExtraAttribute has properties key and value, and the key ...

How can I make all Core Data objects inherit from my class rather than NSManagedObject?

I created my own class that I want Core Data to use instead of NSManagedObject: @interface MyManagedObject: NSManagedObject { id delegate; } I can't use a category since this declares an ivar. All of my Core Data objects use concrete classes rather than being instances of NSManagedObject. I use the code generator to generate these f...

core data and undo errors plus no redo...

So the issue: I drop a some items into an editor area it creates an undo grouping...under the covers, as the whole process of dropping the items is actually a collection of tasks. If I then delete the tasks, I am given an option to undo the delete. If I do this undo I get an error in the console: _endUndoGroupRemovingIfEmpty:: NSUndoMa...

How do I use Mogenerator?

I installed Mogenerator. Now what do I do? How do I use it? The first problem I have is that I have no idea where it was installed to. During the install process, it only let me select the hard drive to install it on, not the directory. The most natural location would be the Applications folder, but it isn't there. Next, the readme (wh...

Changing default parameters of Mogenerator

I'm trying to make Core Data objects inherit from my own custom class rather than NSManagedObject. I started using Mogenerator and noticed that it has a --base-class arugument which does exactly what I want. The problem is that by default it doesn't use this parameter, and so every time I save my data model file, it sets the inherited c...

Placing items from a Core Data entity into an NSOutlineView programmatically?

Sorry if this seems like a silly question - I am an amateur when it comes to Objective-C and Cocoa and even less knowledgable when it comes to Core Data usage. So here's the situation: I have an NSOutlineView that I've already populated with a few items manually with an NSTreeController. What I need to do now is take the items in one of...

How to communicate with web service in JSON and Core Data?

I am writing an application where we communicate with a web service in json. I would love to cache data from this service, so that the user always can show cached data while we are fetching updated data. I have looked into a minor project; Core Resource that is a layer over Core Data. It converts from JSON to data objects, and it looks ...

Weird crash when saving managedObjectContext

I am getting a weird crash when I try to save my model. This is my code: TJModel *model = [TJModel sharedTJModel]; NSFetchRequest *request = [[[NSFetchRequest alloc] init]autorelease]; [request setReturnsObjectsAsFaults:NO]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"TJVideoList"inManagedObjectContext:[model ...

NSPredicate with functions or selectors

I have a lot of people NSManagedObjects that I need filtering and was hoping to do it within the initial fetch instead of filtering the array afterwards. I've used selectors in predicates before, but never when fetching NSManagedObjects, for example I have all my employees and then i use this predicate on the NSArray... [NSPredicate pre...

Core Data: NSManagedObjectContext save crashing with unrecognized selector

I'm trying to add Core Data to an existing application, which isn't easy considering that all the documentation and every tutorial starts out with creating an app that uses core data from the start. So I'm trying to convert an existing model class to be a core data entity. Here's what I did: Add the core data framework. Add an xcdatamo...

How do you create a Set of Entities which all have Relations to other Entities with Specific Attributes? In Core Data.

I've got a Core Data entity called "Card" which has a relationship "info" to another entity, "CardInfo". It's a one-to-many relationship: each card can have multiple CardInfos, but each CardInfo only has one Card. The CardInfo entity just has two strings, "cardKey" and "cardValue". The object is to allow for arbitrary input of data for ...

Delegate variables Vs. Core Data

Hello, I wonder when I should use Core Data and when I just should keep it easy and use delegate variables? ...

Core Data: Create multiple managed objects, but only save some?

I'm trying to write a favorites system for my app. I've already converted my model to a managed object. So imagine the user is presented a screen with a list of such objects. They can choose to save some to their favorites, which will persist them in core data. The problem is, when I create all of these model objects, I do so with the m...

import a .xcdatamodel in CoreData CLI

Hi all, i've a little Problem with a CoreData Command Line Tool. I simply created a new Project in XCode (Core Data CLI), created a Data Model in the .xcdatamodel File and auto generated a Header file. Finaly i modified the Code, wich should able to load the Entity. The Program Compiles without errors, but if i run the Program i get th...

Getting distinct list of ID's in CoreData

What's the most efficient way to perform this query on a CoreData table? To use the standard employees database model -- I want DISTINCT department ID's for all departments that contain employees with job-description "chef." As it happens, there is only a single table (Employees) relevant here -- I don't actually have a departments tab...

NSFetchedResultsControllerDelegate methods not being called when camera image saved in didFinishPickingMediaWithInfo using Core Data

My application allows a user to take an image with the camera or select an image from their photo library. Inside didFinishPickingMediaWithInfo I get the image and save it to the database using Core Data. When I get an image from the photo library I see the following NSFetchedResultsControllerDelegate methods being called: – controlle...