core-data

Why can't I see a Managed Object Class file template in Xcode?

I created a .xcdatamodel Managed Object Model file in Xcode. I selected that file in Groups & Files. Then I go to File > New... > and nowhere in the iPhone Templates / Cocoa Touch Class templates I see the "Managed Object Class" file template. Does anyone know what can be wrong? ...

Why do I get this error "error: expected specifier-qualifier-list before 'NSManagedObjectContext' ?

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, which should actually work. Don't know what that error means... #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface RootViewC...

Cocoa bindings: get old value upon change

I am writing a core data Cocoa application in which there are accounts and transactions (monetary). The account entity description contains a balance attribute. The transaction entity description has a relationship to an account. I need the application to update account balances when transactions have their accounts set or changed. For ...

Core Data multi thread application

Hi all, I'm trying to use core data in a multi thread way. I simply want to show the application with the previously downloaded data while downloading new data in background. This should let the user access the application during update process. I have a NSURLConnection which download the file asyncronously using delegate (and showing...

NSPredicateEditorRowTemplate and CoreData

I am trying to generate predicate editor templates for my Core Data entities. In my code I have the following: NSEntityDescription *descrip = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:managedObjectContext]; NSArray *templates = [NSPredicateEditorRowTemplate templatesWithAttributeKeyPaths:[NSArray arrayWithO...

Background saving with Core Data?

Hi, I have a Core Data based iPhone application that needs to save 1000 managed objects on termination. This takes 8+ seconds, however, the OS kills the app if it does not complete in approx. 6 seconds. I don't want to save the objects earlier, because then the user has to wait 8 seconds longer for the results to display. Is it possib...

Importing large datasets on iPhone using CoreData

Hi there, I'm facing very annoying problem. My iPhone app is loading it's data from a network server. Data are sent as plist and when parsed, it neeeds to be stored to SQLite db using CoreData. Issue is that in some cases those datasets are too big (5000+ records) and import takes way too long. More on that, when iPhone tries to suspen...

Truncated Core Data NSData objects

I am saving arrays of doubles in an NSData* object that is persisted as a binary property in a Core Data (SQLite) data model. I am doing this to store sampled data for graphing in an iPhone app. Sometimes when there are more than 300 doubles in the binary object not all the doubles are getting saved to disk. When I quit and relaunch my a...

How to save Core Data after users update software?

Hello guys, As far as I know, the Core Data store is stored in the application's documents directory. If the user updates the application through App Store, all the data will be removed, right? Can I save data to another place? Thanks ...

Adding custom methods to a subclassed NSManagedObject

I have a Core Data model where I have an entity A, which is an abstract. Entities B, C, and D inherit from entity A. There are several properties defined in entity A which are used by B, C, and D. I would like to leverage this inheritance in my model code. In addition to properties, I am wondering if I can add methods to entity A, which...

Core Data: How do I maintain without retain?

I am trying to debug a very nefarious problem with some iPhone Core Data code. The setup is this: I have a thread which exists to poll a web service and send its results via NSNotification to the main thread (passed in the userDict, a bunch of strings and NSNumbers). I'm using Tim Hatcher's notification library to pass to the main threa...

NSFetchedResultsController not showing updates from other contexts

I have an NSFetchedResultsController set up to populate a UITableView, based off my 'main' NSManagedObjectContext. In a timer, I continually add objects into a separate NSManagedObjectContext, but one that shares its NSPersistantStoreCoordinator with the main context. I can see NSManagedObjectContextWillSaveNotification notifications b...

Core Data Query slow

What's the secret to pulling up items that match characters typed into the search bar that react instantaneously? For instance, if I type in a letter "W" in the search bar, all phrases that contain a letter "W" in any character position within the phrase are returned immediately. So if a database of 20,000 phrases contains 500 phrases w...

Unable to build project with CoreData classes

I am trying to migrate my sandpit code into my main project but for some reason I am getting the following strange error when trying to compile syntax error before 'NSManagedObjectModel' At first I thought this was because coredata wasnt in the prefix.pch file but I have added it in there too. This is the top of AppDelegate where ...

Question regarding iPhone core data and how to duplicate features for multiple users...that doesn't make sense, just read my question :)

So I am working on a simple iPhone app, that uses core data to manage objects. My code is similar in function to Apple's CoreDataBooks app, found here. There is a blank UITableViewCell, and you have the ability to add objects to this blank list. If you hit the add button, a DetailViewController pops up that manages the attribute of each ...

Core Data causing app to crash while migrating

Hi there, I submitted an update of my application to the App Store which requires the Core Data model to be updated/migrated. It is only a simple change with a hand full of new attributes added, and one renamed. It seems to have gone fine for most users, however I've had 2 crash reports that I don't understand. The crashes appear to al...

Abstracting NSManagedObject and NSDictionary

In my project I have some objects that I show from a server, lets call them Foo's. When I get my Foo feed, I parse them into a NSMutableDictionary subclass called RemoteFoo, and pass these RemoteFoo objects all around the app to display data. If the user ends up wanting to download a RemoteFoo, I then create a core-data NSManagedObject...

Core Data and Runtime Key Value Coding

I was under the impression that with key-value coding, I could set any undefined attribute on a NSManagedObject at runtime and no exception would be thrown, but it wouldbe a way to hold objects attached to the model that are not in the data model. For example, I have a Foo object that does not have a "bar" attribute. I though that at r...

Non US characters in section headers for a UITableView

I have added a section list for a simple Core Data iPhone app. I followed this so question to create it - How to use the first character as a section name but my list also contain items starting with characters outside A-Z, specially Å,Ä and Ö used here in Sweden. The problem now is that when the table view shows the section list the ...

Core Data Table View Section Sort by weekdays using NSSortDescriptor

I'm currently trying to sort my array of objects into day order so they can be grouped in the correct order i.e. Monday, Tuesday, Wednesday then by start time. Only problem is I can't figure out how to do this, my code currently looks like this: Which sorts alphabetically then by time: NSString *sectionKey = nil; switch (tab) { case k...