core-data

Migrating from Dictionary to Core Data Entity

I've got a data model where there is a Person entity, which has a transformable attribute which is an array of dictionaries containing information. The model is much bigger than that, this is just the part I'm having trouble with. It was designed this way by an old developer, and in taking over the project I need to migrate this to be 10...

What are all the steps should be taken while shifting a core data programs location?

Hi friends, I did a program using core data and saved it in my desktop. The entities, relationships are available in .xcdatamodel file. Then i copied my entire program into some other folder in disk and erased the original file placed in desktop. Now the copied program did not work. The managed objects are null. What changes must i do ...

Is it possible to have Core Data sort the "many" part of a To-Many relationship during a fetch request?

I'm using Core Data to cache a decent amount of information, and I have a To-Many relationship set up among my managed objects. Naturally I use an NSFetchRequest to fetch an array of the singular side of that relationship. However, I populate a UITableView using the the "many" side of the relationship, and I'd like it to be sorted alphab...

iPhone Core Data: How to copy NSSet from one entity to another?

This code is used to make "initial data" or "test data". The Category entity will carry default types. The Subcategory entity will copy default types from the Category. They wouldn't be using the same types because new or old types may be deleted or added to the Subcategory. -(void)newCat:(NSString*)catName subCat:(NSArray*)subCatN...

Saving Core Data database to sqlite file loses some recursive/circular relationship information

I have very simple circular (or self-reflecting) relationship core data model in my iPhone word game. Entity Word has one-to-many relationship to/with itself which points to related words: I use NSPersistentDocument Core Data Mac OS X template application to import words to Core Data sqlite database. After importing data I can see al...

How to fetch one to many relationship in core data?

Hi, Let say the data entities are: Bookshop <--->> Books How do I fetch all books belonging to a specific book shop that contain "cloud" in the name for example? The following method feel clunky. Bookshop *bookshop = (Bookshop *) nsManagedObjectFromOwner; NSString *searchTerm = @"cloud"; NSFetchRequest *fetchRequest = [[NSFetchReque...

Reflect changes to objects in a relationship in parent object with NSFetchedResultsController

Hello all, I have two entities event and time. The event entity has a 1 to many relationship to time entities as each event can be performed multiple times. Now I want to display all the events chronologically in a tableView. So I set up a fetchedResultsController to fetch all time objects, sort them according to the start time and disp...

Can't Release NSFetchedResultsController in dealloc

I have two UITableViewControllers with a fairly simple ui flow. One UITableViewController loads another UITableViewController when you select an item in the first UITableViewController. (UITableViewController) List of Stories -> Select a Story -> (UITableViewController) List of Sentences In the second UITableViewController (MakeSen...

Core Data lightweight migration: Can't find or automatically infer mapping model for migration

So I created a new version of my data model, and made a previously optional field non-optional (giving it a default value). According to the documentation, this should mean my migration is eligible for lightweight, automatic migration. I also added options that allow this when I open the store, also per the documentation: NSDictionary ...

Saving an instance of an NSManagedObjectContext does not permanently save a mutable transformable attribute

I'm using Core Data + sqlite as a data cache. The app reads in a file into core data, then uses Core Data to run the app. Saves are done to both the NSManagedObjectContext and to the file. I've noticed, though, if I quit the app and reload it without repopulating the Core Data database, some (but not all) of the data saved using -save: i...

Core Data application hangs with I try to scroll a Table

I have a little trouble with a Core Data tutorial I am working on. The program hangs if I try to side-scroll a TableView with bound data. There isn't much data in the table at all, maybe 8 or 10 rows only. But every time a scroll I get the spinning beach ball for some seconds. For the application I have written almost no code. I created...

Can I use NSFetchedResultsController for the display of data not meant for a UITableView?

In the FRC documentation, it says that it is intended to efficiently manage the results returned from a Core Data fetch request to provide data for a UITableView object. I am trying to setup my Core Data stack to handle the storage and retrieval of some VERY basic data. Can I not use FRC? I need to display a value set in the db to a UIL...

Understanding local core data syncing between multiple iOS devices using iTunes

I'm diving into iOS development and I have a quick noob question about Core Data. As I understand it, any data that in an app's Documents folder is backed up to iTunes when the user syncs their device. Does that mean if my core data sqlite db is in the Documents folder, then that data will be synced between multiple devices with the same...

Relationships between static application data and updatable user data with Core Data

I am developing an iPhone application that has a large database of items which the user can mark as favorite or add to certain lists. Currently, the SQLite file is first copied from the bundle to the document directory to make it writable and used as a Core Data persistent store. However, I will run into problems when I need to deploy a...

countForFetchRequest and executeFetchRequest return different numbers of results

I'm finding that a NSFetchRequest is returning different results for a count and for an execute. I have a Product entity and a Size entity. A Product has many Sizes. I have two products, productA and productB. ProductA is only available in size1 and productB is available in both size1 and size2. Given the NSPredicate 'ANY sizes.#siz...

Possible to use Core Data with different pre-populated sqlite db's?

I am not that familiar with core data so im wondering if its possible to load different pre-populated sqlite db's into core data and how the performance would be? I have a client who is storing their data in multiple sqlite db's on a remote server. Each sqlite db would basically represent a group in the app and there could be anywhere f...

Core Data errors in iPhone app. "_OBJC_CLASS_$_NSFetchedResultsController"

"_OBJC_CLASS_$_NSFetchedResultsController", referenced from: objc-class-ref-to-NSFetchedResultsController in RootViewController.o I'm getting 7 of the errors above in my iphone app. I had an app that used core data but i wanted to use an rss xml parser with it, so i created a new empty app and put both of the projects into it, now i hav...

Problem with NSManagedObjectContext crashing app

I have a navigation based app that uses Core Data for storage. The schema for this particular section is as follows: Scene hasMany Tasks hasMany DeviceCommands Tasks also have many other objects besides DeviceCommands (like DelayCommands etc), but this is beyond the scope of the problem (I think). DeviceCommands also link to a parent ...

Core Data: storing web content before saving

I am currently developing an app that relies heavily on retrieving web content. I have a series of NSObject classes that represent the content that I retrieve in JSON format. I also have NSManagedObject classes that represent my Core Data model that are almost identical. Here is an example of an NSObject class that I use to hold my web ...

Why don't I have to release managedObjectContext in the 2nd TableViewController.

Hi all. I have two tableview controllers showing CoreData objects. One is a detail view (with sentences) one is an overview (with stories). Pick a Story -> See the Sentences. It looks like I was over-releasing my managedObjectContext; I originally released it in both TableViewControllers in dealloc and got a crash every third time I we...