Hi all, I've been trying to get to grips with Core Data and I'm having some difficulty with my fetched results. The problem is that I have 'Branch' objects which have a to-many relationship to 'Telephone' objects. When I return a 'Branch' and try to access all related 'Telephone' objects from the returned NSSet, I seem to only get one ...
I have a question concerning Core Data and how, if at all, Entities get updated automatically.
Basically, let's say I fetch some data X. X has an inverse to-many relationship with Y. Then a method get's called to update an attribute in X. Does one have to fetch the data again? or will X automatically get the updated data?
If this is no...
Hi,
So I've transferred the core data code from Apple's sample Core Data / RSS parser application, TopSongs, into my own application. It loads fine, (i.e. no errors or warnings) and the first time you open the app all that happens is the UIActivityIndicator spins and then stops. No data displays in the UITableView.
You then have to clo...
Hi, my app shows a map with annotations fetched from core data. Currently I do performFetch in viewDidLoad for the map, however, this is delaying the map from appearing immediately on the screen when I select its tab in my tabViewController. Is there a more appropriate place to call performFetch or is there something else I'm doing wro...
I have encountered a problem of placing data into the Table View. Here is my current code.
I am unable to load the results from the class I tried to use NSFetchedResultsController, but it won't work. Can any one see the mistake.
This is the header file.
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import <sqlite3.h>
#import "...
Guys,
I have a ConfiguracaoDaApp class in my project that is a NSManagedObject subclass. I didn't change the default code that XCode generates.
I declare a instance variable of that type in my app delegate and in my appDidFinishLaunching method, I have been try to assign it's value from a object retrieved from the database like this:
...
Hello everyone,
I am trying to create a NSFetchRequest that produces results for a UITableView.
It should find all the distinct occurrences of a NSString property and split them into alphabet sections ('A', 'B', 'C', etc.)
I have set up a method on my NSManagedObject class to return the first letter of the property:
- (NSString *)ent...
I have an abstract entity called Block which contains two attributes: column and order (which are not optional), and one relationship, thing, where it is the detail of a 1->M. I have another entity, Whatever, that has Block as its parent, and adds one attribute, someNumber.
My code looks like this:
Whatever *block = (Whatever *)[NSEnti...
In my core data model I have a Person entity that has a "to many" relationship a Course entity (I also have an inverse "to one" relationship from Course to Person).
Now I have a subclassed UITableViewController that uses a NSFetchedResultsController to display Person objects which works fine. I have this set up so that when you click o...
I'm have an issue where i'm updating a many-to-many relationship in a background thread, which works fine in that threa, but when I send the object back to the main thread the changes do not show. If I close the app and reopen the data is saved fine and the changes show on the main thread. Also using [context lock] instead of a different...
I'm not sure whether or not this is the appropriate way of doing this, but I was wondering what's the best way to approach a relationship to a value in a list with Core Data? For example, say you have a 'person' entity. Each person can have a different 'hair color'. I'm trying to basically define the hair colors in my data model and allo...
I'm implementing a new iPhone app and am relatively new to Cocoa development overall. I am at the stage of choosing how the persistence layer of this app will work, and it looks like I'm basically choosing between Core Data and sqlite3.
The persisted models in this app are intended to have a schema that is loaded at runtime (from some ...
In CoreData, I have the data graph with some entities, and each object is populated in a view controller, at a defined screen, I want to pop out some (>1) objects to return to a define screen.
I tried to pop the view controllers out of the navigation stack with these lines of code:
ObjectA *objectA = objectD.objectC.objectA;
NSLog(@"ob...
I'm trying a multithreaded Core Data implementation on iPhone SDK 3.1.3. I have two different NSManagedObjectContext objects for each thread and I am registering for the change notifications on one thread like below:
- (void)setup {
DLog(@"Registering for NSManagedObjectContext notifications");
NSNotificationCenter *nc = [NSNoti...
I have my CD store setup and everything is working. Once my initial fetch is performed, I need to perform several fetches based on calculations using the data from my first fetch. The examples provided from Apple are great, and helped me get everything going but I'm struggling with executing successive fetches. Any suggestions, or tutori...
Hi
I was just wondering, I have an app that relies on Core Data for saving user inputted data and a plist file for keeping track of user settings etc.
What happens when I, as a developer, put a new version in the store and a user downloads the update? or a new user downloads the app? How will I make sure their data and settings are not...
I'm using NSValueTransformers to encrypt attributes (strings, dates, etc.) in my Core Data model, but I'm pretty sure it's interfering with the sorting in my NSFetchedResultsController.
Does anyone know if there's a way to get around this? I suppose it depends on how the sort is performed; if it's always only performed directly on the d...
Hi,
I can't figure out why this is happening. I can add to the context. But when I retrieve the objects, it returns the correct number of objects but the attributes of the objects are null.
I am adding 3 instances with this code:
+(BOOL)addStoreWithID:(NSNumber *)ID Latitude:(NSNumber *)latitude Longitude:(NSNumber *)longitude Name:(N...
Hi All,
Can any trig or GPS experts help me out here? I'm trying to create a geo-spacial bounding box (rectangle) calculation returning the maximum latitude and longitude using the following method that I've retrieved. I am calling the method once for each of the for bearings: north, south, east and west. With these four values I intend...
I have an T-SQL background so this CoreData stuff is a little new to me.
I am prototyping an app which will eventually use an MS SQL backend webservice for querying.
In my backend my t-sql query would be something like this:
SELECT *, SQRT(SQUARE(myX - latitude) + SQUARE(myY - longitude)) Distance
FROM Locations
WHERE latitude > myX ...