core-data

Core Data - Relationship to dissimilar entities

Suppose I have the following data model: Entity Person Attribute name String Attribute personType String Attribute dailyRecords Entity CarpenterDailyRecord Attribute numberOfNailsHammered Int Attribute picNameOfFinishedCabinet String Entity WindowWasherDailyRecord Attribute nameOfBuildingWashed String Attribute numberOfWindowsWashed I...

How to check existence of reference to an NSManagedObject?

I successfully stored and retrieved a reference to an NSManagedObject using the example found in this site http://cocoawithlove.com/2008/08/safely-fetching-nsmanagedobject-by-uri.html The problem is, the app crash whene triying to retrieve an NSManagedObject which has been deleted. I tried the method isFault on the object, but it alway...

How to store short date format to db?

I use Core Data and I want to store this formatted date to db, field type is date, how can I do this? date formatted: 2010-10-31 I hope I explained my scenario. Sorry for my English. Greetings. ...

How can I use a pre-populated core data DB on my device.

Hi all, I have developed my app using core data. It works fine in the simulator. When I deploy it to the device the DB is empty. It is 49k where it should be 484k. Basically it is not populated. Since I don't write to the DB when the app is running I need to provide a populated DB to the App. So I copied the populated DB from th...

Core Data - Structure

Hi, I'm trying to create a xcdatamodel for my applicationa and I wanted to know how I could design the schedule timing with the course...to be more clear, I'm going to allow users to enter the day of the week and the start time and end time their course is on. and users can add as many courses. Can someone provide me with the best solu...

CoreData Relationships Synchronized with a Traditional Database

I have an existing database schema that is used in both an online (MySQL) and desktop (SQLLite) version of my product (data is synchronized between the two). I am now developing an iPhone version (CoreData) that I hope to synchronize with one or both of the existing products, but I am having trouble deciding how to manage entity relation...

Programmatical Creation of NSMappingModel

I want to programmatically (without Lightweight Migration) create a mapping model between two models that are exactly the same, except one of the entities (there are a bunch of entities) has different attributes. Let's call this entity "Person". And let's say the destination model has 1) added a new attribute called "address" 2) delete...

Core data and @unionOfSets

Im having trouble using the @unionOfSets on my core-data objects. I have a subclass of nsmanagedobject called list. There is a to-many relationship from list to listElements. and each listElement has a one-to-one relationship with a file. NSLog(@"%@", [NSApp valueForKeyPath:@"delegate.mainWindowController.sidebarViewController.arrayCon...

How to add database layer in core data application

Hi all I am fairly new to core data technology and i searched a lot on how to add the database to a core data application.so can anybody guide me on how to integrate the database layer? i have seen the iphone tutorial on core data (i.e books example) but i am not able to understand how to .sqlite file has been included in that applicati...

Problem with the name of an NSEntityDescription

This problem follows on from a previous question. When I run the following line of code: NSEntityDescription *outputCellEntityDescription = [NSEntityDescription entityForName:@"OutputCell" inManagedObjectContext:[[self document] managedObjectContext]]; I get the followin...

Create Managed Object Model From Existing XSD - iPhone Core Data

I have several existing XML schema files with a defined data model. I would now like to incorporate the exact data model in an iPhone app, using Core Data for persistence. Does anyone know if there is a way to create a Managed Object Model other than by using the graphical tool in Xcode? It would take me a long long time to have to go th...

Best way to store date/time into core data

Hi, For each course I am storing the day of the week the class the user has...and the start and end time and room no. What would be the best approach in terms of data type, Like for storing time?? so that when I pull it out I can display it e.g 1:00 PM. Thanks! ...

Core Data - NSPredicate to filter to-many relationship

I have 2 entities, Task and List. Each task has a to-one relationship to a List object called "list", and there is an inverse relationship with List, which has a to-many relationship with Task called "tasks". I'm trying to use a fetch request with an NSPredicate to get all the Task objects that belong to a specified List: NSPredicate ...

Referencing Entity from external data model - Core Data

I have a external library which includes a core data model, I would like to add a new entity to this model which has a relationship with one of the entities from the library. I know I could modify the original, but is there a way to without needing to pollute the library? I tried just creating a new model with an entity named the same, ...

Core data, sorting one-to-many child objects

So if I have a store of parents children and the parent has a one to many relationship to children (parent.children) and they all have first names. Now, on the initial fetch for parents I can specify a sort descriptor to get them back in order of first name but how can I request the children in order? If I do a [parent.children allObje...

NSFetchedResultsController fetch request - updating predicate and UITableView

In my iPhone Core Data app I have it configured in a master-detail view setup. The master view is a UITableView that lists objects of the List entity. The List entity has a to-many relationship with the Task entity (called "tasks"), and the Task entity has an inverse to-one relationship with List called "list". When a List object is se...

Save object in CoreData

I am using CoreData with iPhone SDK. I am making a notes app. I have a table with note objects displayed from my model. When a button is pressed I want to save the text in the textview to the object being edited. How do I do this? I've been trying several things but none seem to work. Thanks EDIT: NSManagedObjectContext *context = [fe...

UIDatePicker storing only time in core data

I am using a UIDatePicker with time only, How can I store this type in the core data, would it be date:S. Thanks ...

getting record from CoreData ?

Hi. I am trying to add value to CoreData from .plist and get from coreData and show them on UITable. I made take from .plist and send them to CoreData .But I cant take them from CoreData entity and set to some NSMutable array.. Here my codes Edit : SOLVED NSString *path = [[NSBundle mainBundle] pathForResource:@"FakeData" ...

Core Data Error "Fetch Request must have an entity"

Hi, I've attempted to add the TopSongs parser and Core Data files into my application, and it now builds succesfully, with no errors or warning messages. However, as soon as the app loads, it crashes, giving the following reason: UPDATE: I've got it all working, but my TableView doesn't show any data, and the app doesn't respond to th...