I have predicate inside of - (NSFetchedResultsController *)fetchedResultsController in a standard way starting from the CoreDataBook example.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"state=%@ && date >= %@ && date < %@", @"1",fromDate,toDate];
[fetchRequest setPredicate:predicate];
This works fine however when ...
I am trying to set a fetch request with a predicate to obtain records in the store whose identifiers attribute match an array of identifiers specified in the predicate e.g.
NSString *predicateString = [NSString stringWithFormat:@"identifier IN %@", employeeIDsArray];
The employeeIDsArray contains a number of NSNumber objects that matc...
I've enabled editing mode and moving cells around to allow users to position table view content in the order they please. I'm using Core Data as the data source, which sorts the content by the attribute "userOrder". When content is first inserted, userOrder is set to a random value. The idea is that when the user moves a cell around, the...
My question is similar to this one.
Background
I'm creating a large number of objects in a core data store using NSOperations to speed things up.
I've followed all the Core Data multithreading rules - I've got a single persistent store coordinator and a managed object context per thread that on save is merging back to the main managed...
My situation is similar to this question. I am using lightweight migration with the following code, fairly vanilla from Apple docs and other SO threads. It runs upon app startup when initializing the Core Data stack.
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersisten...
I have a user interface where the user can check off a bunch of items from a tableview, almost like a todo list. The items are populated from a Core Data stack.
I need to be able to take all of the items they're clicking through and put them into a "temporary" shopping cart. Once they're in the shopping cart, users can go through the l...
I have a core data based app that manages a bunch of entities. I'm looking to be able to do the following.
I have an entity "SomeEntity" with the attributes: name, type, rank, foo1, foo2.
Now, SomeEntity has several rows if when we're speaking strictly in SQL terms. What I'm trying to accomplish is to retrieve only available types, ev...
I have a application that combines threading and CoreData. I and using one global NSPersistentStoreCoordinator and a main NSManagedObjectContextModel.
I have a process where I have to download 9 files simultaneously, so I created an object to handle the download (each individual download has its own object) and save it to the persisten...
In Core Data, if I have a Person entity is there any difference between:
NSManagedObject *aPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:[self managedObjectContext]];
or
Person *aPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:[self manage...
I have a UITableView that gets populated from CoreData via a controller that implements NSFetchedResultsControllerDelegate. How can I have it automatically select the first row (and fire the tableView:didSelectRowAtIndexPath message)?
The tableview is used for a variety of predicate queries, so I'm suspicious of solutions that work on t...
I noticed several questions related to this topic go unanswered. Is this such a gray area that nobody really understands it?
Here is my problem:
I am a midway in the development of my app and the app has never been used ouside of my iphone simulator.One of the attributes in my core data structure requires a type change.Since my app has ...
I have made a data model, and now I've made a 2nd version. All of the generated NSManagedObjects mapped to that data model are all version 1. Is there some way to update them to v2 without deleting them and then saying having them generated again?
...
Afternoon all,
I tried to add a second data entity to the persistent store in the (locations) coredata tutorial code, and then access this in a new view. I think that I've followed the tutorial, and checked that I'm doing a clean build etc, but can't see what to change to prevent it crashing.
I'm afraid I'm at my wits end with this one...
I will be doing an occiasional import from XML into core data. I have around 50k entities that will be added. My question is how often should I call [managedObjectContext save:&error]. For every new entity added, or every x entities, or just at the end of the 50k import?
I currently am calling it for each entity and tried only doing it ...
Hi everyone,
Let say I have an entity user which has a one to many relationship with the entity menu which has a one to many relationship with the entity meal which has a many to one relationship with the entity recipe which has a one to many relationship with the entity element.
What I would like to do is to select the elements which be...
I have an application that contains some Locations in Core Data, and I want to show them to the user in order of proximity to the user's location. I am using an NSFetchedResultsController to serve the locations to the Table View. I thought about creating a virtual accessor method that returns the location's distance from the user, that w...
OK so I have two entities in my data model (let's say entityA and entityB), both of these entities have a to-many relationship to each other.
I have setup a NSFetchedResultsController to fetch a bunch of entityA. Now I'm trying to have the section names for the tableview be the title of entityB.
sectionNameKeyPath:@"entityB.title"
N...
I have an entity called 'Job' with two boolean attributes named 'completed' and 'logged'.
I am trying to retrieve all completed jobs that have not been logged at app start-up and change them to logged. I'm able to get all the completed but unlogged jobs with this fetchRequest:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@...
In developing a few CoreData applications, I've found the automatic UI prototyping extremely useful while experimenting with the CoreData model. By automatic UI prototyping I mean selecting a CoreData entity in XCode and option-dragging it to a window in Interface Builder.
This brings up a dialogue box in IB allowing me to select some o...
Hi everyone,
I have an entity which has relationships with other entities. Let say we have: user->menu->meal
My problem is that some of the users don't have a menu. So when I try to check: user.menu.meal == rice I get an error (path not found...)!
Thank you for your help!
...