core-data

Do I need to import the AppDelegate_Phone.h file?

Do I need to import the AppDelegate_Phone.h file (which in turn imports AppDelegate_Shared.h)? I am trying to use Core Data. The AppDelegate_Shared.h already has it set up. If I want to read information into a UITableView from Core Data, must I import my delegate file explicitly? ...

Adding Core Data in Universal app?

I'm trying to add Core Data to an app that loads news form of an RSS feed so I can store articles offline. I am using ASIHTTP to load the data off of the internet as XML. I'd like to store the articles in Core Data so I have them the next time I start. My AppDelegate_shared already is set up for Core Data, based on the template, but I'...

Is there a way to instantiate a NSManagedObject without inserting it ?

This is an iPhone dev question about CoreData. I have a user interface to insert a Transaction. once the user clicks on a plus he gets the screen and i want to instantiate my Core Data NSManagedObject entity let the user work on it. Then when the user clicks on the Save button i will call the save function. so down to code: transa...

How can I refresh a NSFetchedResultsController?

I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler plate code provided by Xcode when choosing to create a Core Data project. I added the following predicate to the NSFetchRequest the NSFetchedResultsController uses (before NSFetchedResultsController is initialized): NSPredicate *predicate = [N...

crash application in deleting tableview

Hi, I am using core data. When i delete row (in section there is only one row so indirectly i have to delete section), application is crash and i get following error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 4. The number of rows contained ...

Core Data question

Hi, the problem I am trying to solve in an application that is using Core Data is to be able to hold a calculated value in a NSManagedObject custom ivar. The calculated value that I want to store is in fact an image. I do not want to persist these images; I build them and destroy them throughout the lifetime of the application. I tried a...

Core data migration from simulator to device

I'm using Core Data and my app works perfectly in the simulator but on the actual device the database is empty. I enabled CoreData logging, so I see the actual tables being created, and queries run but all the queries are empty. I also copied the app from the device and verified that the schema is created but with no data. What am I m...

Core Data, filtering out child entities in result set

So I have typical 1:M relationship: Car can have many Models I want to get all Car objects and only Model names that begin with 'A'. I tried a subquery: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Car" inManagedObjectContext:_context]; [fetchRequest...

NSTokenField representing Core Data to-many relationship

Hi, I'm having a problem figuring out how to represent a many-to-many relationship model in a NSTokenField. I have two (relevant) models: Item Tag An item can have many tags and a tag can have many items. So it's an inverse to-many relationship. What I would like to do is represent these tags in a NSTokenField. I would like to end up...

Best way to maintain column data when importing multiple formats

Hi all, I have an app that imports a .CSV file and turns each line into a Core Data object that is stored in a database. The CSV files that I am importing have about 40-something columns and each column maps to an attribute of the Core Data object. When I started the project, there was only one CSV format that I was working with, so I...

Easy way to link UITableViewCell to Object property in CRUD using Core Data

Hi, First, I have different forms that i generate automatically (UITableView). My forms consits of textfields, pickers, and switches. I generate them by using a self wrote plist file with a logic in it. Second, I have made up the objects to fill up via my datamodel and they work fine. Now, It' time to look for "the best practice" to f...

CoreData could not fulfill a fault after MOC refreshed - how to solve?

Hi guys I'm new to iphone development and have this problem with Core Data. At the moment my app works as follows: I'm executing a fetch from Core Data and display my list of objects in TableView Detaching new thread, create new MOC for it, as advised, Getting xml, parse it, then clear Core Data and fill it with new data from xml Sav...

How to fetch complete objects (not faults) from CoreData?

Hi everyone, I'm new to CoreData concept, and may be I'm getting something wrongly, but I want to fetch fully-qualified array of data from CoreData (not these abstract faults). My problem is that I displaying a list of objects from CoreData to user in UITableView and at the same time refreshing data in background thread. If user is scr...

How to auto-select next row after deleting current row by core data context?

I am using Core Data to manage objects and using a NSTableView to display those objects. The table columns are binded to objects' properties through a NSArrayController. When users click the delete button, all selected objects in the NSTableView will be deleted. Then only remained objects are left in the NSTableView. This works smoothl...

Create a timetable with CoreData

Hello everybody!! I'm new to Stack Overflow and have my first question. I want to develop an application with a timetable. I've one UITableViewController and one CoreData entity called 'SchoolClass'. With arrow buttons I can switch between the days of a week. My problem is that I want to have all classes in the entity 'SchoolClass'. When...

Core data fails to open store: "Error validating url for store"

I've been working on an app for quite a while and suddenly started to hit this error when the app tries to open a Core Data store. I hadn't made any changes to my data model or the data access code for over a month, so I don't think it can be anything that I'm doing wrong as far as interacting with Core Data. (Meaning, the URLs are ok,...

NSManagedObjectModel versionIdentifiers

The documentation for NSManagedObjectModel -versionIdentifiers says, The Core Data framework does not give models a default identifier, nor does it depend this value at runtime. For models created in Xcode, you set this value in the model inspector. I am not sure, but I think that setting version identifiers might help me as I go a...

What's the most efficient process for parsing XML and building a Core Data database?

Let's say I'm getting I'm receiving XML files from some web service, like these two examples.. <news> <item id="123" created="10/09/10" expires="07/07/10" modified="10/09/10"> <title>Xiabo receives Nobel></title> <content>Lorem ipsum lorem ipsum</content> </item> </news> . <products> <item id="1" category="shoes"> <name>Nike Air</nam...

iPhone - Core Data Questions ???

Above is my data model diagram. Everytime i create a Car whcih contains a model and make, it adds a car object to core data. The problem is that it also adds 1 make and 1 model to the core data, so i get duplicates. for example, in the following code, it saves 1 car object 2 models, and 2 makes, so I get a duplicate Make in my table (...

How to get all entries of a NSFetchedResultsController/NSManagedObjectContext ?

Hi I have a nice working iphone app that works with core data. I use a NSFetchedResultsController/NSManagedObjectContext as described in various tutorials. Now I want to extends my app and add some more features. The problem I need to build up an array with objects that have informations from my data. I somehow need to get a list of a...