core-data

What is the fastest way to sort a lot of locations on distance?

I want to sort lots of locations (waypoints) on their distance from the current location. The current location is, of course, a moving target, so for every location update, recomputing the distance for every location is necessary. But only recomputing for close-by locations would by enough. I currently use core-data, and store the dista...

Seemingly inconsistent behavior among NSManagedObject subclasses

I have several subclasses of NSManagedObject. They are all instantiated with code something like this: MeasurementDescriptor *descriptor = (MeasurementDescriptor *)[NSEntityDescription insertNewObjectForEntityForName:@"MeasurementDescriptor" inM...

Raw Data or Pre-Calculated Values in Database?

In general, is it better to store raw data with pre-calculated values in the database and concentrate on keeping the database up-to-date if I remove or delete a row while using the pre-calculated values for display to the user OR is it better to store the raw data and calculate the correct display values on-the-fly? An example (whic...

subclassed NSManagedObject does not call description when NSLog'd

I have a data model which has two entities in a relationship of one to many. Each entity has a class that is subclassed from NSManagedObject. I get the relation set for the one entity and walk it casting each set member to the specific subclass as I enumerate the collection. When I do NSLog(@"My Entity: %@", myEntityInstance); It ...

What is the Proper way to create new to-many relationship in CoreData?

I have an entity called "Client," and each Client can have multiple "Properties." CoreData creates methods on the Client class for me for adding a new Property to the set, but I don't understand the purpose of this. Is there any difference at all between: Property *newProperty = [NSEntityDescription insertNewObjectForEntityForName:@"Pro...

How to get one more datapoint beyond the requested data-range in core-data?

I'm working on an iPhone app which graphs a large database, accessed through core-data, in a line-chart. I'm using a tile-based approach to rendering this graph. The distance between datapoints is irregular. Each tile uses a predicate to retrieve the data that is relevant for that tile: NSPredicate* predicate = [NSPredicate predicat...

NSPredicate problem with column name

I am trying to query a table using NSPredicate. Here is essentially what I'm doing: NSNumber *value = [NSNumber numberWithInteger: 2]; NSString *columnName = @"something_id"; NSLog(@"%@ == %@", columnName, value); NSPredicate *refQuery = [NSPredicate predicateWithFormat: @"%@ == %@", columnName, value]; NSLog prints out what I expect...

reading binary data (rtf) to string

Hello, I've been working on a core data program for a while now. I'm trying to combine attributes of an entity in a text view for saving to PDF and Printing. One of the attributes of the entity uses binary data. When I execute this: NSData *myData = [object valueForKey:@"cueNotes"]; ...it returns this: typedstreamè@ NSMutabl...

Why do I get this error "error: expected specifier-qualifier-list before MyTableViewController

1) I have the CoreData.framework imported. In Groups & Files I see it in the Framworks list together with UIKit.framework, Foundation.framework, CoreGraphics.framework. 2) I have this code, I am not sure what this error means #import <UIKit/UIKit.h> @interface SQLLiteDemoAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *wi...

iPhone Core data entity lookup

I have a very simple problem that i'm sure has a simple solution, but after searching the internet for 2 days I can't find anything on it =( Here is the situation: I have decided to break my data into 2 sperate entities with a one-to-one relationship. So I have the PERSON entity and FEATURES entity. each PERSON has a related FEATURES en...

Possible to use two separate SQLite databases?

I have one sqlite database in which I store both user-defined information and information which is read-only to the user. I feel like I may need to modify the read-only information in the future, and I don't want to have to do a whole data migration. Is there a way that I can use a separate sqlite database, which can easily be replaced, ...

Core Data Managed Entity Object Class usage Problem

Hi I have this application which is saving tweet messages from twitters public time line. For that I have created a "Tweet" entity in my model & has generated a managed object class from XCode. I have declared Tweet ivar in my controller class & have synthesized it but when I try to put some value in it like tweet.text = @"Some parse...

iPhone - Core Data Question ??

I have 2 entities : User, Address. I have set the relationship each User can have many "Address". I am not sure how core data works but from my understanding, every time i call insertEntityForName it creates and stores an object. (also a row in table) So the question: Doesn't the following code store a duplicate address in core data? ...

Correct time to delete persistent store to delete all entries of an entity

Hi, I am using an UITableViewController containing a UITableView and an UISearchTableView. The table lists e.g. 1000 entries. I want to provide the user a button to delete all entries of a specific entity. Because looping over all managed objects and saving the context takes a very long time, I thought of deleting by removing the persi...

How to set NSManagedObjectID manually?

I want to sync the Core Data on iPhone with MongoDB on Sinatra server. When the iPhone gets a message from the Node.js chat server, the message contains the sender's BSON ObjectId (a string). For the iPhone to store this message, I find the user with that same Id in Core Data. I want to be able to do something like objectWithID. In othe...

Custom Core Data accessors for transformable UILocalNotification

Hi there, I have a transformable attribute on one of my entities, called reminder. It's a UILocalNotification. Now, since I want to schedule it when it's added, and cancel it when removed, I would like to override the accessors to handle the scheduling and cancelling in there. How would that look? Thanks! ...

Nested undo with NSUndoManager and Core Data

Hi there, I have a little problem with NSUndoManager. When the user is about to edit some entity A, I stick everything into an undo grouping so that the changes can easily be undone. So far so good. However, while the user is editing entity A, he can also add or edit items of entity B, where A has many B and B belongs to many A. That r...

Why is my app crashing when I modify a Core Data relationship in an NSOperation subclass?

Background I've got the following tree of objects: Name Project Users nil John nil Documents nil Acme Project Acme Project <--- User selects a project Proposal.doc Acme Project ...

Core data Relation Fault (not lazy loading) problem. Relations dissaper

Hello Everyone, I have a core data database which has (for now) 2 entities Product and CompetingProduct, CompetingProduct relation is set to-many with products. I create 2 mock Products and 2 mock Competing products and set relation between them .. everything works files.. Saved to database, also NSlog, "po" them.. all is good. Now.. ...

Core data issue

I am starting with iphone development and am facing an issue with core data. I have a model gathering several entities such as employee, project, project type, etc. On startup, I create several entities that I persist through the core data framework. No problem. The issue raises when I want to display a list of projects basing on a tab...