core-data

Regarding coredata[sqlite] corruption

Hi All, I am working on a chat application and using coredata to store the names of the person from which you have started chat to make it persists during application launches.... The problem is sometimes my sqlite db gets corrupted..The error that I get is:- Unresolved error Error Domain=NSCocoaErrorDomain Code=259 UserInfo=0x2d3...

Using an NSManagedObject subclass entity in both an in-memory store, and a SQLite store

I would like to use a single NSManagedObject subclass to represent an item. However, much of the time, the items I will be representing are fleeting, and are not to be saved to the persistent store. It seems like an in-memory store would be the correct setup. However a few times the user can choose to 'save' an item, and thus I would th...

Core Data background sync conflict issue

I'm running into a crash issue while developing an iPhone app with Core Data. The app syncs data with a webservice on a background thread. When the app first launches, the existing data in the Core Data DB will be displayed to the user in a UITableView, while a background thread is kicked off the grab the latest data from the web ser...

Algorithm for inserting/deleting cells in UITableView based on Core Data object?

I have a core data recipe object that contains an ordered list of ingredient objects. The ingredients are displayed as a list in a UITableView. When the user cancels editing of the table view, I call rollback on the MOC, which may restore some ingredients (any that the user has deleted) and remove others (any that the user has added). ...

Core Data Beginner...

does someone know where i can find example to do that case ? 2 entities : Catalogue of books and Books. One relation to-Many between. I found many tuto to explain how to make appears A book of selected catalogue (tableview) but none for a "double" tableview which is simple i suppose. The first tableview will present all the book's catal...

NSFetchedResultsController and my TableView structure

I have a tableView controller with two sections. The first section has a couple of input fields and is not really displaying core data. The second section displays items from a database saved with Core Data. I have an NSFetchedResultsController and I serve up data for cellForRowAtIndexPath and didSelectRowAtIndexPath as follows. Fo...

Is it OK to have multiple NSManagedObjectContext instances per thread?

You have to have one per thread, but beyond that ... should you have more? Is it harmful to have more? For instance, I'm tempted to build my app around having one NSManagedObjectContext per tab, handling the subset of the overall persistent store that appears on that particular tab. That way, I can have the tab GUI listen to notificata...

Importing Complex XML into Core Data via NSXMLParser?

Hi all- I've been working on importing XML into an iPad Core Data application. I have a working NSXMLParser implementation for my files, and have been able to import the simpler (ie attribute-only) elements into Core Data. Some of the XML dated has nested elements with text, and I'm a bit stumped on how to get Core Data to play nicely ...

iPhone Core Data Lightweight Migration Cocoa error 134130: Can't find model for source store

Folks, Lightweight migration is failing for me 100% of the time on this line: [persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error] with the error: Error: Error Domain=NSCocoaErrorDomain Code=134130 UserInfo=0x4fbff20 "Operation could not be completed. ...

Core data: can NSFetchedResultsController fetch two different entities?

I am working on an iPhone app, and in a particular view I need to load two different entities: One that will populate a UITableView, and another that will populate a UITextView. Is it possible to fetch both properties using a single NSFetchedResultsController? Or do I need to use two different NSFetchedResultsController? Any ideas on...

Objective-C - CoreData and TableView refresh

Hi, I have one problem. I have managed to read/write/delete records in CoreData. But now I am dealing with one problem. In my app delegate I create TabBarController and add some NavigationControllers in it. In one taleView in navController I want delete record and when I switch to another tab I want see that record there. I can do that...

Core Data and JSON question

I know this question has been possed before, but the explanation was a little unclear to me, my question is a little more general. I'm trying to conceptualize how one would periodically update data in an iPhone app, using a remote web service. In theory a portion of the data on the phone would be synced periodically (only when updated). ...

sorting NSMutableArray weird results with Core Data

Hi all, I have been going over this for hours and cannot find the problem. I have an array of scores which I save at the end of a game in a core data model. After saving when I go back into the high scores viewcontroller I load the scores from core data and sort the array using the following function where scores array is an NSMutableA...

adding cerated instances to CoreData

Hello i just first tried out core data right now. I created an App which loads Locations from a Server and creates by using a JSON-Parser dynamically Model-Instances of Class "Location". Works fine and no problems. Now i need to store some locations as favorizedLocations localy on the client. Therefore i want to use CoreData. I had s...

core data simple update ?

hi all, i'm beginner on core data and try to understand how to simply update an object wich is already stored myObject is a NsManagedObject setValue forKey needs .. a key but how could i update with something like setValue:mynewvalue forkey:myObject.key ok that 's not the way... have an idea with example please? thanks ...

How can I sanely approach version control and Core Data models?

When we put Core Data model files under version control with git, we always have a horrible time merging changes - the only sure fire way we've found to avoid having to merge in changes by hand is to communicate among the team to block off access to the model while one person makes their necessary changes and pushes, then the next person...

NSPredicate issue

Hello everyone, I have 2 tables, 1 table is called table car and 2nd is called history. A car can have many histories so basically a history will have a foreign key carid which represents the car id. I am trying to extract all the history that is associated with the car but unfortunately, it keeps returning me every single history. ...

Fetching and sorting across entities in Core Data

Lets say I have a model similar to the one below, and I need to Fetch all 'Person' of a specific Company.companyName sorted by personRole.roleWeight This is the model I have at the moment: Entity: Company Attributes: companyName Relationships: companyRole Entity: Role Attributes: roleName, roleWeight Relationships: rolePerson, Rol...

core data exception from deleting dummy row that was never in core data

I have a UITableView tied to core data. When there are no entries, I hack the table to make sure that #sections = 1, #rows = 1, and that this row displays text that says "your table is empty; add a new item using the + button". When the user adds his first item by clicking the + button, though, core data throws an exception saying that...

Core data: How do I create playlist and add songs from a database?

Hi, I am working on this core data app, and im not exactly shure how to do what i want. Right now my first view displays a list of playlists. I can add a playlist to the list. The plus sign pops up addViewController. From here i can add a name to the playlist, now comes the tricky part for me.. I want to be able to select songs from a...