core-data

Cocoa Bindings: NSObjectController not KVC-compliant for the representedObject property

I've been through a bunch of Core Data examples and the Apple documentation. I'm at a wall after working on this all day. All I want to happen is I type some text into a text field, save the file, open it again and see the text there. I made a very very simple Core Data document-based app to experiment. Here are the particulars: 1) ...

Trying to save document window dimensions through Core Data

Hi there. I am trying to save the dimensions of my document window through Core Data. I have used the following code to save the width and height: managedObjectContext = [[[NSDocumentController sharedDocumentController] currentDocument] managedObjectContext]; NSSize windowSize; windowSize.width = documentWindow.frame.size.width; windo...

Is NSPersistentStoreCoordinator Thread Safe?

I'm working on an iPhone app that uses Core Data. The app makes a call to a web service, parses the resulting XML file, and then creates or modifies Core Data objects in my app. I already handle the web service call and parsing asynchronously, but I've been handing the parsed data back to the main thread to manipulate the Core Data objec...

Core Data and UITabBar Controller - help?!

So I have a Project with a UITabBarController and a few Navigation Controllers, and I am trying to implement Core Data. Its just not working. I have a bit of a weird setup: UITabBarController -> Navigation Controller -> Table View Controller I have copied all of the Core Data code and added an entity with an attribute ('Event' and 'nam...

Persistant Store and App Update Question

Hey gang. I have an iphone app up on the store which uses core data. Now, every time I change something in my code with relation to core data, namely my managedobjectmodel or my model classes, I have to wipe all my data since I get a persistent store error. Now I'm finding i need to make changes to my app and I don't want my users to lo...

How do I restore a NSUndoManager's contents in a CoreData NSManagedObjectContext?

I'd like to use NSUndoManager in an iPhone application on CoreData (NSManagedObject) objects such that I can save (and later restore) the state of the NSUndoManager if the application exits prematurely (say, due to a phone call coming in). I.e. as opposed to automatically discarding or saving the changes accumulated in the NSUndoManager...

Core Data with A-Z sections

Hello, I am trying to add an A-Z index for a core-data populated table using the example here: http://blog.sallarp.com/iphone-core-data-uitableview-drill-down/ However, I can't work out where I can set my sectionNameKeyPath property in the core data helper header file: Do I need to make a NSFetchedResultsController like they do in C...

Problem accessing relationship objects in an NSManagedObject

My managed object has a relationship called items. My subclass has a method called itemCount. Unfortunatly my attempts to get the object count in the items relationship always returns 0. Here's the relevant code: @interface List : NSManagedObject {} @property (nonatomic, retain) NSSet* items; @property (nonatomic, readonly) NSNumber * ...

Specify a File Name and Path for an NSPersistentDocument

In Cocoa, when the user wants the document they're working on saved I need to have the file saved with a specific file name and path. The functionality I'd like is after the sheet comes up that says "Do you want to save the changes..." and the user presses "Save", I provide the file name and path and the file saves (for new documents of...

Persisting data objects on the iphone

I was wondering what your thoughts were on persisting objects (NSDictionarys and NSMutableArrays of Objects) on the iPhone? I've gone through a couple of options in my head: 1.) We persist using NSUserDefaults, this method seems the easiest and I sort of want to just go ahead and use this. The Data I want to store would only maybe be ...

How do I unlink and remove a related object in CoreData

I have a core data entity which has an exclusive one to many relationship with another entity. This relationship is supposed to be a basic containment the first entity contains one or more of the second. An instance of the second entity can only be contained in one of the first entities. I want to be able to remove all the contained ent...

iPhone: core data error: +entityForName: could not locate an NSManagedObjectModel for entity name 'Name'

See title ^ Code causing this: NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; Name *name = (Name *)[NSEntityDescription insertNewObjectForEntityForName:@"Name" inManagedObjectContext:context]; Feature *feature = (Features *)[NSEntityDescription insertNewObjectForEntityForName:@"thing" inMan...

NSFetchedResultsController not updating UITableView's section indexes

I am populating a UITableViewController with an NSFetchedResultsController with results creating sections that populate section headers and a section index. I am using the following method to populate the section index: - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return [fetchedResultsController_ sectionIn...

Core Data - Getting Unique Rows

I'm working on an iPhone app that uses Core Data. I have only one entity called Books, and that entity has the attributes Title, Author, ISBN, Description and Shelf. I'm working on the book editing view, and want to have a UIPickerView listing all of the unique Shelf rows so that the user can just pick a shelf. My question is -- how d...

How to import data to Core data

I am building an iPhone application which pulls a lot of information from an webservices that sends XML. The problem now is that I am going to import a set of data that needs to import in 4 or 5 related tables. It depends if the city exists in Core data. The database looks like this: City - Club - track The way how I would do it now i...

Data Persistance in iPhone Applications

In the development of my first serious iPhone application (Meaning I'd like to actually get it out on the AppStore), I needed a good way to represent my data. Instead of going with core data, I (stupidly, I think) decided to use classes to represent my data. I created three classes, MMDot, MMShowMovement, and MMShow. The MMShowMovement ...

Core Data "Upsert" from SQLite Database

I am currently writing an App that needs the ability to modify and persist various pieces of data. I've decided to use Core Data for this purpose. When the user opens the Application for the first time I need to import a large amount of data from a sqlite database, this data consists of the many-to-many relationships. I'd like to find ...

Handling Core Data Model Changes.

I know that if you change the Core Data model and you have run the app before on the old model that you will get Persistent Store error. How would you handle changes to the Core Data model so you do not get this error? Is there a way to upgrade an old model so that the already saved data is not lost? ...

Simple fetch with .@count predicate taking a long time (~30seconds)

I have 2 entities, A and B that have a many to many relationship. The A entity has about 10,000 objects in, and B has about 20 objects. Basically, A objects can be related to one or more B objects, and the B objects keep track of which A objects they are connected to. This is done with the inverse relationship setting. I simply wish t...

iPhone CoreData Queries

Hey there, I'm new at using CoreData and I'm trying to understand how to perform a query on a table. I can use a fetch request to pull all of the records from a table, but I'm looking for a subset. Is there an easy way to do this? Thanks, Howie ...