Hey all,
I'm new to Cocoa programming, and decided for my first project to create a small application to monitor and remember certain battery stats for my laptop. (I have it plugged in most of the time, and apple recommend you discharge it now and again, so why not try to make a small program to help you remember to do this? :))
Anyway...
I have Two models Department and Worker. Departments has to-many relationship(workers) to worker.
Worker has firstName field. How can i get a worker list sorted by firstName by accessing departmet.workers? Is there any way to add sort descriptors in to-many relationship?
...
I have setup Core Data for an iPhone app without an instance of NSFetchedResultsController.
To do this, I created a created a model class to encapsulate all core data requests and constructing of NSFetchRequests/NSPredicates.
This kept all Core Data specific code out of my UITableViewController.
Now I want to add NSFetchedResultsContr...
With MapKit in the iPhone 3.0 SDK, you create objects that conform to the MKAnnotation protocol. Loading these onto the MKMapView is very easy. However, when a user scrolls the MKMapView, it's time to load new annotations. A likely place to request the new objects would be in mapView:regionDidChangeAnimated: which is called when the map'...
Hi, I am trying to develop a test Core Data app so i can use it in my main app. But im having problems fetching stored data.
I have 1 Entity "User" with 2 attributes: name (String) & email (String)
I can successfully populate my store file with data...
here is the code im using below.
Any help would be greatly appreciated.
NSManagedOb...
I'm using NSFetchedResultsController to drive the data for my UITableViewController. A simplified version of the managed object I am fetching looks like this (well for example):
Person:
-(BOOL)hasPet;
-(BOOL)hasDog;
Basically, I want my table to only show those Person objects who have a pet. So that's simple, I can use a predicate. No...
Since CoreData has become available for the iPhone in OS 3.0, is it meant to be the answer to data persistence and replace all need for direct SQLite?
What reasons exist to still use SQLite? What are advantages/disadvantages of SQLite vs. CoreData?
...
Is it possible to create sqlite index based on "multiple fields" using core data?
In my present sqlite based schema, I have an index based on two fields, name and state. How do I create similar index using core data?
...
I am trying to get the number of rows for a given request. The only obvious way I've found to accomplish it is:
NSManagedObjectContext *context;
NSFetchRequest *request;
...
NSInteger count = [[context executeFetchRequest:request error:&error] count];
This seems wasteful to me, building an entire array of a large database's objec...
I would like to use Core Data Managed Objects outside of a managed object context. I've seen other threads on this site that say you should never do this, but here's my issue:
I have a 'Feed' object and a 'story' object. Feed is like an RSS feed, and story is like a single story from that feed. I have the ability to bookmark feeds, and ...
I can't figure out why, for the life of me, the NSFetchedResultsControllerDelegate methods are not firing when I add data to the underlying datastore. The data shows up immediately if I restart the iPhone application.
I have subclassed UITableViewController and conform to NSFetchedResultsControllerDelegate:
@interface ProjectListViewCo...
I'm moving my initial steps in the Core Data realm (and I'm quite new to iPhone development, too) and I found a behavior I cannot explain.
I declared a subclass of a NSManagedObject and defined a few properties, some of them of type NSString *, MyObject.h is something like:
@interface MyObject : NSManagedObject {
}
@property (nonatomi...
I have some data structures in my app that I need to persist upon receiving 'didReceiveMemoryWarning' notification. The data is kind of a running log of all of the actions the user has performed with the app (which is a game)
The data I have may not be a small amount (possible > few hundred KB) so plists don't seem to be the right solut...
I have a CoreData entity (waypoint) with a foreign key to another entity (track). When the foreign key is set, or if it is not set, this if statement works fine:
if ([wp track]) {
thirdLabel.text = [NSString stringWithFormat:@"Part of Track: %@", [[wp track] title]];
}
However, if the track that the waypoint is keyed to has been del...
I've got a Core Data model set up, with two entities in a one-to-many relationship (Items, and for each item, there can be multiple ResetDates). I'm pretty confident the model is set up correctly.
I can add new Items, and when doing so, add a new ResetDate (using the current date, with [NSDate date]). I can retrieve and display Items. W...
Is it possible to create sqlite index based on "multiple fields" using core data?
In my present sqlite based schema, I have an index based on two fields, name and state. How do I create similar index using core data?
...
The docs for NSFetchedResultsControllerDelegate provide the following sample code
- (void)controller:(NSFetchedResultsController *)controller
didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath
forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath {
UITableView *t...
I'm doing design for a project and nothing's been implemented - so I'm still going through the thought process to determine if Core Data is viable for the project.
Here's my query -
I want to create a managed object model using Core Data to represent some server side objects e.g Folder, File, etc....
All the objects (Folder, File etc.....
I am creating my own bindable custom treeview. For that I would like to observe NSTreeController for updates to its items' to-many-relationships. NSTreeController is bound to CD managed object context. Every depth level has its own CD Entity with parent/children/isLeaf properties. I need to maintain same hierarcy in the view (and order o...
I am building an iPhone app that contains medical information for medical professionals.
The data has a sort of taxonomy which is easily represented in the form of e.g. a mind map on a piece of paper. On the device, the idea is to navigate through a series of items in table views to get to a detail view with text and picture information...