core-data

Can i get/set the index generated by checking the 'indexed' checkbox? (core data)

I have 2 entities. entity A will hold many entity Bs and order will matter. if i check the little box that says 'indexed' in xcode, how do i go about using that index, if i even can? ( i know that i CAN use it in some way: http://cocoawithlove.com/2008/03/testing-core-data-with-very-big.html but i am not so spiffy with Obj-c yet.) I h...

Saving an Array to Core Data

Hello, I'm trying to save an array to Core Data. I've been reviewing the following thread: http://stackoverflow.com/questions/537044/storing-custom-objects-in-an-nsmutablearray-in-nsuserdefaults (in particular the answer from Stefan). My code is as follows: for (TempWorkout *newTempWorkout in items) { NSString *st...

a simple core data save problem

I started learning core data and I wanted to do a simple category->object->detail application. I started with the location tutorial. After I've done it, I moved all the auto-generated code from my appDelegate to a new DataProvider class and i put a tabbar at the beginning of the app. So I have a TableView tabbar item (with a navigation c...

Core Data - get/create NSManagedObject performance

Hi. I'm creating an iphone/ipad app that basically reads XML documents and creates tableviews from objects created based on the xml. The xml represents a 'level' in a filesystem. Its basically a browser. Each time i parse the xml documents i update the filesystem which is mirrored in a core-data sqllite database. For each "File" encou...

Cocoa Bindings: Binding to the "many" end of a to-many relationship

Using the Employees-Departments example what I want to do is bind a column to "[email protected]" as outlined below: Entity Employee attributes: "firstName", "lastName", "hoursWorked" relationship: "departments" Entity Department attributes: "name" relationship: "employees" I want a table wh...

Can I use instance variables with an NSManagedObject?

So I got entities Level and Tile. Level has a to-many relationship with Tile. Tile has a property 'index'. Right now I'm using this code to get the tiles array of Level sorted: - (NSArray *)sortedTiles { NSMutableArray *sortedTiles = [NSMutableArray arrayWithArray:[self.tiles allObjects]]; NSSortDescriptor *sortDescriptor...

Can CoreData handle polymorphic subclasses?

I have a CoreData model (managed object) called Item: @interface Item : NSManagedObject { NSString * type; } @property (retain) NSString * type; @end I also have two subclasses of Item: @interface Circle : Item @end @interface Square : Item @end I track the subclass of the item by the type property. When I fetch my Items, I ge...

iPhone - Core Data question ?

In XCocde when you create a data model diagram, it will also generate the classes for each entities in the diagram which inherit from NSManagedObject. The question is are these classes considered my "Model" classes? OR are they just a bridge between my core data and model classes? PLease if you have a good tutorial let me know, i've be...

IPhone: Why are Bulk Inserts in Core Data so slow?

So I'm making an iphone app that just has a thousand entries that I'm reading from an xml file into core data. But inserting these records takes like 10 seconds on the device. It's pretty ridiculous. The schema is very simple, just one table. I.e., no relationships or anything. To see what I mean, you can just go to: 1. File -> New Pr...

What is the most efficient data structure to store time series of partially changing array?

Hi All, My problem is I have an array of objects of size N. after every time (t+1), some of the values of the array may or may not change. so lets say t+1 index 15 changes but everything else stays the same. What is the most efficient way to store something like this (in memory ) apart from just having an array of arrays of course? I w...

My iPhone core data app runs perfectly the first time but crashes when run after that

Hi, my app is based around two classes: Jam and JamItem, each with a TableViewController to display / add items. The model contains two entities for the two classes, and there is an optional one-to-one relationship between them. JamItem has a name field and a price field. Jam has a quantity field. There are corresponding NSManagedObject...

NSManagedObjectContext save causes NSTextField to lose focus

This is a really strange problem I'm seeing in my app. I have an NSTextField bound to an attribute of an NSManagedObject, but whenever the object is saved the textfield loses focus. I'm continuously updating the value of the binding, so this is far from ideal. Has anyone seen anything like this before, and (hopefully) found a solution? ...

iOS / Core Data: How to create a predicate for words that start with a range of characters?

The 'Like' is pretty simple it seems, it only supports ? and * I believe, kind of like old-school wildcards. But I want to do this: Find all words that begin with a given range of characters... for example a-j. So I got it to find all words that start with say, the letter j: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"...

Dump after some changes in CoreData Model

Hi there, I did some changes at my CoreData Model. So far, I added a attribute called 'language'. When my application is launched and I click on "Create new Customer" a instance variable Customer is created. This variable is created by: Customer *newCustomer = [NSEntityDescription insertNewObjectForEntityForName:@"Customer" inManagedOb...

Is it OK for other threads to have indirect access to a managed object context running in a thread of its own?

Apple's recommended method for multithreading core data is to use a managed object context per thread, and to send changes from one context to another by saving the changed thread's context to a shared persistent store. While I can imagine that being fine for, eg. an RSS reader, for some applications it seems far from ideal. In my case,...

CoreData "Error validating url for store"

I'm having a problem in my application, CoreData works as it should in he simulator - but not on the device. I receive an 2010-09-30 12:45:07.500 CoreDataTutorial_iOS[130:307] Unresolved error Error Domain=NSCocoaErrorDomain Code=513 "The operation couldn’t be completed. (Cocoa error 513.)" UserInfo=0x1412a0 {NSUnderlyingException=Err...

iphone: NSPredicate problem with NSFetchedResultsController

I currently have a 'Topic' entity defined in my system as: @interface Topic : NSManagedObject { } @property (nonatomic, retain) NSString * path; @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSNumber * topicID; @property (nonatomic, retain) NSNumber * parent; @end I want to fetch a topic with a specif...

Is SQLite FTS3 still the best way to go for rolling out your full text search?

I need to support full text search for a 10 mb document and wondering if I should implement FTS with CoreData or Sqlite3. I am familiar with CoreData and not too fond of Sqlite3. Anyone with experience care to enlighten me? What other options do i have? Thanks! ...

Core Data - Relationships

I have three core data entities which I am importing into, they are: • sizes (Name, Clothes (one to many with "Clothes" entity)) • Clothes (Name, Price, etc... +2 relationships) • shop (Name, Clothes (one to many to "Clothes" entity)) I have imported shops, into shop and sizes into the sizes entity. Now I am importing the clothes. ...

Core Data Crashes When Trying To Save After Delete

I am having problems with the context in Core Data not being able to save. I get random crashes when I try to call [context save:]. Sometimes it works, sometimes it doesn't and crashes the app. Here is my delete code. I have been able to reduce the number of crashes by checking if [context respondsToSelector] save. The strange this is e...