core-data

Unable to create a .xcdatamodel file in Xcode

I am trying to add a data model to an existing Xcode project. I am doing so by... File -> Add Files... -> iPhone OS/Resource/Data Model -> next -> (name the model) -> Next -> Finish. What I get is an empty blue folder named mymodelname.xcdtamodel and no editor. I tried creating a new windows based (use core data for storage checked) p...

Best way to move a project into a new project

I have not found any answer to why I cannot add a data model to an existing project. So given the fact that creating a project from scratch using core data for storage does create the data model correctly I am trying to move the entire project into a new project that contains the data model. No matter how I try to do it at some point it...

Address Book contacts in Core Data

What’s considered ‘best practice’ when saving Address Book contacts in Core Data? I’m writing an iPhone App, based on Core Data, where I need to save and recall Address Book contacts as part of the data model. In the UI I plan to present a screen where the user can pick a contact from the current Address Book, create a new contact to s...

Core Data: Inheritance, STI or otherwise?

I can't seem to find any information in the documentation or via Google on this, but if there is something, a pointer to it would be great. In my app, I have a Thing as a core data class. I intend to have that Thing contain many Items which has a bunch of fields in it, like order and created_date and so forth. However, there are a varie...

How do I convert NSMutableString to double for storing in Core Data?

Hi, my app needs to store latitude and longitude values parsed from XML into Core Data. Currently, I have a Core Data Model which has these attributes set to type double. The header file for the Model Object has them defined as NSNumber How can I convert the string stored in my CurrentNodeText variable into the required type for stor...

Populating sqlite db created by CoreData

I have a sqlite DB created by my CoreData model automatically, but my app will not give the user the ability to write data into it, instead I wanted to pre-populate it with all the data the program needs. My problem is that the sqlite DB created by CoreData has unknow tables and fields that where not present in my model. Is there anywa...

Core Data: -deleteObject: Crashes, Are Delete Rules the Cause?

I have the following model, as you can see in the image. My application requires refreshing every instance of B, so at each viewWillAppear, I need to delete all the B's in the model. Upon deleting a B, the cascade delete rule on the relationship to C will delete all C and then cascade to all D. A & E are constants. I have the Delete...

Using Cascade Delete Rule and validateForDelete on a One-to-Many Relationship in iPhone Core Data

Preface: I have two entities defined as a one-to-many relationship: A <<-------> B. B's relationship to A is called myAs and is a to-many relationship with Nullify as the Delete Rule. The inverse relationship from A to B is a to-one relationship with Cascade as the Delete Rule. I have implemented validateForDelete on the B class like s...

Core data many-to-many relationship - Predicate question

In my Core Data model I have two entities: List and Patient. List has an attribute called 'name'. A List can have any number of Patients and each Patient can belong to any number of different lists. I have therefore set a relationship on List called 'patients' that has an inverse to-many relationship to Patient AND a relationship on Pat...

CoreData and NSXMLParser

Hi Stackoverflow friends, I am parsing an XML file of the network using NSXMLParser after I got the Data from NSURLConnection. The XML has many "items" and each item contains 1 category. In the CoreData module i have an Item entity with a relationship to one Category. While parsing the XML file and hitting the message parser:didStartEl...

iPhone Development: MapKit with CoreData

Is there a good resource (book, article/tutorial, video, audio) on working with both MapKit and CoreData together? An article with some tips and tricks to efficiently utilize the memory and avoid running in to memory warning situations? I appreciate any personal advises that you can give me, as well. ...

Core Data 1-to-many relationship: List all related objects as section header in UITableView

Hi: I struggle with Core Data on the iPhone about the following: I have a 1-to-many relationship in Core Data. Assume the entities are called recipe and category. A category can have many recipes. I accomplished to get all recipes listed in a UITableView with section headers named after the category. What i want to achieve is to list all...

When last row in section of UITableView with Core Data is moved -> NSRangeException

Hi: Moving rows between sections in Core Data backed UITableView works quite fine after I've implemented a 'userDrivenChange' check in 'controllerDidChangeContent:', as mentioned in the apple docs. But only when moving the last row of a section to another section I get a NSRangeException. There is obviously a problem when sections get e...

Core Data executing a "sub query"

Hi, I would like to execute some kind of subquery with my fetchedresultscontroller. I've got a set of items which have a flag like "viewed" or "not viewed". Is it possible to switch between these items... Sure I could do a complete refetch but this takes some time. Is there a better way for doing this? Many thanks! ...

Core data to-many NSPredicate with AND

I'm trying to write a query for the find-as-you-type search bar. What I want to do is query "Kind", and return any Kinds for which there is a LocalName with ('name' LIKE %@ AND localeIdentifier == %@). If I'm only searching the names (so ignoring the localeIdentifier), I could do something like this: ANY localized.name LIKE %@ What...

Core Data: editing object from detail view

I'm just starting out with Core Data and I have an iPhone Core Data project set up in a master-detail view system. The master view contains items, and the detail view lets you edit the properties of the selected item. I'm looking for the best options in order to implement the editing. Would I pass along the NSManagedObjectContext to the...

iPhone How to modify the data contained on the Persistent store using Core Data

Hello, I'm stuck trying to figure out how to modify the data contained on the persistent store. I'm writing an application with several views using a tabBarController, my core data methods are located mainly on the main application delegate but I will only be using this data from the tableViewController view. In order to use the manage...

How do I get Attributes from Core Data into an Array for - iPhone SDK

Hi All, I'm trying to retrieve data from Core Data and put it into a Mutable Array I have an Entity called 'Stock' and in Properties, attributes called : code, price & description... How do I get the data stored in these attributes into a simple Mutable Array? I've added this code... NSMutableArray *array = [[NSMutableArray alloc]...

Grouping a Core Data data result?

I am prototyping an idea on the iPhone but I am at the SQLite vs CoreData crossroads. The main reason is that I can't seem to figure out how to do grouping with core data. Essentially I want to show the most recent item posted grouped by username. It is really easy to do in a SQL statement but I have not been able to make it work in co...

Synchronizing Core Data data with External Database

I have started working on an iPhone application that where I need to synchronize data with an external MySQL database. The current database scheme uses GUID/UUID fields as primary keys to maintain relationships between tables. I already have this working between a database app and the MySQL database, so this isn't a question regarding sy...