core-data

insert and modify a record in an entity using Core Data

I tried to find the answer of my question on the internet, but I could not. I have a simple entity in Core data that has a Value attribute (that is integer) and a Date attribute. I want to define two methods in my .m file. First method is the ADD method. It takes two arguments: an integer value (entered by user in UI) and a date (curr...

core data fetched property

Since days I am looking for how to use my fetch property. I dint find anythink that works/helps in google. So I hope anybody can me help here. The Problem: I have an "Entity A" and an "Entity B". In "Entity A" I have an "one-to-many" Relationship to "Entity B". Also in "Entity A" I have a fetch property. The fetch property use variables...

CoreData: migration from 2 models

I have general app model, after was released any body can do plug-in for it, this plug-in can determine new db parts which merged with my general db. After some time i 'll release new db version^ and plug-in writers may release new version of their dbs. So i need map old version of merged db into new version. How i can do this? ...

How to efficiently save changes made in UI/main thread with Core Data?

So, there have been several posts here about importing and saving data from an external data source into Core Data. Apple documents a reasonable pattern for this: "import and save on background thread, merge saved objects to main thread." All fine and good. I have a related but different problem: the user is modifying data in the UI and...

Memory efficient way of inserting an array of objects with Core Data

I'm working on a piece of code for an iPhone application that fetches a bunch of data from a server and builds objects from it on the client. It ends up creating roughly 40,000 objects. They aren't displayed to the user, I just need to create instances of NSManagedObject and store them to persistent storage. Am I wrong in thinking that...

Can I separate merged model into source parts?

Can I separate merged model into source parts? Need to do it for reason of upgrade to new versions my every or not every source part of db. It must work under 10.5, so i cant use inferredMappingModelForSourceModel. ...

Store XML data in Core Data

Hi, is there any easy way of store XML data into core data? Currently, my app just pulls the values from the XML file directly, however, this isn't efficient for XML files which holds over 100 entries, thus storing the data in Core Data would be the best option. XML file is called/downloaded/parsed ever time the app opens. With the Co...

Objective-C: fetchManagedObjectsForEntity problem

Hi.I am trying to get value from CoreData entity name Person with predicate and then comparing with new data in dictionary.But it it returns every time 0 .And it creates about 5 person with same name. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"userName == %@",[flickr usernameForUserID:@"owner"]]; peopleList = (...

What do you need to implement to provide a Content Set for an NSArrayController?

Heys, I am writing something in Xcode. I use Core Data for persistency and link the view and the model together with Cocoa Bindings; pretty much your ordinary Core Data application. I have an array controller (NSArrayController) in my Xib. This has its managedObjectContext bound to the AppDelegate, as is convention, and tracks an entit...

iPhone Development - Query related records using CoreData

I have a case where i have three entities with one-to-many and one-to-many relationships: Entity A (Entity B relationhip), Entity B (Entity A relationship, Entity C relationship), Entity C (Entity B relationhip) I have the reference of Entity A, and now i want to fetch all the related Entity C records. How can i do that? (with least ...

core-data NSDate searching for unique days and sorting

Lots of information on NSDates about the place, but I haven't found a clear solution to this. I have a list of Event entities, each with potentially many EventSessionTimes. Event <--->> EventSessionTime In 1 table view I want to display a unique list of days that have Events, in another table view I want to show the events on a parti...

Objective-C: updating UITableView with recursive function?

I am trying to re-call core-data in UITable using model view. I am in UITable in - (void)viewDidLoad method using getting some data from internet and setting them entities and showing them on UITable.It works normal ,but Now I am trying to use new addModel view and in this model view I can type user name in textfield and save it in ...

Core Data - How to check if a managed object's properties have been deallocated?

I've created a program that uses core data and it works beautifully. I've since attempted to move all my core data methods calls and fetch routines into a class that is self contained. My main program then instantiates that class and makes some basic method calls into that class, and the class then does all the core data stuff behind t...

NSFetchedResultsController deallocated instance

Anyone ever encountered this ? -[NSFetchedResultsController _restoreCachedSectionInfo]: message sent to deallocated instance While performing fetch with performFetch: using NSFetchedResultsController instance. I'm sure the NSFetchedResultsController is retained before performing the fetch. ...

Core Data ANY BETWEEN predicate

I'm trying to create an NSPredicate to find 'projects' that contain 'sessions' within a certain date range. I tried this at first: [NSPredicate predicateWithFormat:@"ANY sessions.date BETWEEN {$STARTDATE, $ENDDATE}"]; But I get an exception: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'to-ma...

creating managed objects using code in xcode & core-data

New to objective-c xcode and core-data so sorry for the remedial question. I have set up a very simple data model: Entity1 and Entity2, both contain a single attribute (String) and a one-to-many relationship with the other. I want to scan Entity1 and depending on the results of the scan create one or more Entity2 objects that link to...

Core Data multi-threading

My app starts by presenting a tableview whose datasource is a Core Data SQLite store. When the app starts, a secondary thread with its own store controller and context is created to obtain updates from the web for data in the store. However, any resulting changes to the store are not notified to the fetchedresults controller (I presume b...

Array of custom objects now updating on core data save

In my data model I have an attribute that stores an array of objects. This is setup using an attribute that is transformable, and I am NSKeyedArchiver to convert the array of objects to an NSData object for storage. The object conforms to NSCoding and seems to be stored into the data store without issue on creation. I can close the ap...

Objective C, Core Data issue

I'm following a tutorial in "More iPhone 3 Development. In the code, they have a line: NSManagedObjectContext *managedObjectContext = appDelegate.managedObjectContext; I get an error: "accessing unknown 'managedObjectContext' getter method" on that line. I've downloaded his sample code and his program runs fine with that line of code....

Building a NSPredicate for a filter

Hi, Just wondering what the best way to build a NSPredicate is if some filters are optional? This is basically for a filter, so if some options aren't selected I don't to filter by them eg. If I have option1 and option2 set for the filter. NSPredicate* predicate = [NSPredicate predicateWithFormat:@"option1 = %@ AND option2 = %@] .......