core-data

How does Core Data work

Ive tried to gather information on as to how core data works, but can someone give me a clear explanation of all the stuff required...For instance NSDataContext, Fetchcontroller, NSDataModel, Presistent... Perhaps all the steps involved to get a data...Now I'm also unclear about an SQLite file, like how do we load the data into the core...

How to sync iPhone and Mac CoreData objects through bonjour?

I know similar questions have been asked before. I'm using the Sync Demo app I found online here, which uses Picture Sharing as a guide. I've integrated it into my desktop and iphone apps and have the connection working, but am clueless as to how to actually sync my objects. Is it as simple as if ([iphone Object] != [desktop object])...

exc_bad_access on insertNewObjectForEntityForName:inManagedObjectContext

Update I wrote a minimal code example of the issue I am having. I implemented the background work two ways: manually spawning threads and letting NSOperation handle threading. In both cases I am creating NSManagedObjectContexts for each thread/operation. When I spawn the threads myself with performSelectorInBackground:withObject: eve...

Custom Section Name Crashing NSFetchedResultsController

I have a managed object with a dueDate attribute. Instead of displaying using some ugly date string as the section headers of my UITableView I created a transient attribute called "category" and defined it like so: - (NSString*)category { [self willAccessValueForKey:@"category"]; NSString* categoryName; if ([self isOverdue]...

Retrieving Relationships from within two arrays of pointers

In a portion of a program I'm working on, I need to count all the times each person has worked on projects with each other person. Let's say we have "Employee" entities and "Session" entities. In each session, there are four project types, "A", "B", "C", & "D", each a many-to-many relationship to Employees. I'm making a loop to system...

NSManagedObjectContext losing data after 2nd save

I have a class called DataRequest, which handles downloading data from a web service via NSURLRequest, parsing the results and stuffing data into a NSManagedObject, and saving it. It contains the fowlling: @property (nonatomic, retain) id DataControllerProtocol dataController; I also have a class called DataController, which encapsul...

NSFetchedResultsController: changing predicate not working?

Hi, I'm writing an app with two tables on one screen. The left table is a list of folders and the right table shows a list of files. When tapped on a row on the left, the right table will display the files belonging to that folder. I'm using Core Data for storage. When the selection of folder changes, the fetch predicate of the right ta...

Core Data - Limiting number of saved objects

Hi! Is there way to limit the number of saved objects in coredata like stack, where the last objects are automatically deleted? ...

Looking for an elegant way to store one-to-many relationship in coredata when order is important

I've been trying to come up with a way to solve my problem, but every solution I can think of is messy and makes me want to retch. I have a one-to-many relationship, consisting of a Team object that can have many Member objects. When I built my data model using Xcode, I was given the default NSSet in which to store the member objects, ...

Best way to store a string in an iPhone app?

I've started a new iPhone app that needs to remember a single, 40-char string. That's it. I've hooked into Core Data, and am reading about it now, but it really seems like overkill. Is there an easier way to do something so simple? ...

help core data tableview not reloading

i am using core data...my table view does not reload say if i add a new row to the table. until i terminate the app and re open it...im calling reloadData in my root controller viewwillappear method... any help would be appreciated thanks in advance ...

Core Data - Breaking A Relationship

Hi, I have a Patient entity and a List entity. A Patient can belong to several different lists and a list can have several different patients. Say I have a patient who belongs to 3 lists (A, B, C). I want to remove the patient from lists A & B. I do not want to delete lists A & B themselves though obviously. How do I go about doing thi...

NSRangeException Issue

Hi, I am writing a Core Data-based iPhone app and I am new to Objective-C. I have a bug that I am really struggling to nail. The iPhone simulator keeps crashing with the following error message: 2010-03-21 17:37:40.583 Patients[3689:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray insertOb...

Crashes in Core Data's Inferred Mapping Model Creation (Lightweight Migration). Threading Issue?

I'm getting random crashes when creating an inferred mapping model (with Core Data's lightweight migration) within my application. By the way, I have to do it programmatically in my application while it is running. This is how I create this model (after I have made proper currentModel and newModel objects, of course): NSMappingModel *m...

Core Data migration problem: "Persistent store migration failed, missing source managed object model."

The Background A Cocoa Non Document Core Data project with two Managed Object Models. Model 1 stays the same. Model 2 has changed, so I want to migrate the store. I've created a new version by Design > Data Model > Add Model Version in Xcode. The difference between versions is a single relationship that's been changed from to a one t...

objective-C : Reset tableview loaded with feltching objects (core data)

hi, i have a tableview application loaded with core data feltching objects and i wanna know if it is possible to reset the table with a simple button. Thanks code to add an object : NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchReque...

Core Data: Keypath "objectID" not found in entity

I'm using NSFetchedResultsController with a predicate to load a list of Documents in my application. I want to load all the Documents except the currently active one. I am using Rentzsch's MOGenerator to create a _Document class and then I put all my custom code in the Document subclass. _Document generates an objectID property with typ...

How does the iPhone SDK Core Data system store date types to sqlite?

I used core data to do this: NSManagedObjectContext *m = [self managedObjectContext]; Foo *f = (Foo *)[NSEntityDescription insertNewObjectForEntityForName:@"Foo" inManagedObjectContext:m]; f.created_at = [NSDate date]; [m insertObject:f]; NSError *error; [m save:&error]; Where ...

Unique Values from Core Data

Hi guys, I have a core data-based app that manages records of auto dealerships. Each record stores the dealer's address, which is broken into addressLine1, addressLine2, city, state, and zip components, each stored as a string in the data store. I would like to present a list of cities with dealerships to the user, so I'm trying to fi...

How to debug 'no entities specified' when working with ZSync and CoreData Syncing

I'm trying to get ZSync to work between a desktop and iPhone app. I've got my schemas set up and all info matches between my MOM and my schema so I should be good to go. When I initiate my sync, however, I get this error. |Miscellaneous|Error| SyncServices precondition failure in [ISyncSession _validateClient:entityNames:beforeD...