I've got an entity
called clients and an NSArrayController
called clientsController. In my clients entity I have an attribute called clientCompany.
What is the most straightforward way of programmatically getting a list of each clientCompany while running a loop (so that code can follow on from each discovered clientCompany)? I'm not sure whether I should be accessing the array controller or the managed object in this case.
I've tried:
for (NSDictionary *key in clientsController) {
NSLog(@"%@", [key objectForKey:@"clientCompany"]);
}
with no luck, but I think I'm way off on that. I've also tried printing the arrangedobjects of the array, out of curiosity, but it prints empty:
NSLog(@"%@", [clientsController arrangedObjects]);
clientsController has been initialised and accessed elsewhere in the program so I thought it would be straightforward but I'm very new to all this. Thanks.
Update
I've had a small bit of success going the
NSManagedObjectContext
route and trying NSFetchRequest
. Requesting ObjectAtIndex:0
I can now print the first clientCompany string to the console. I just need to be able to pull all them out in a loop but the hard part is done (I hope).
This worked for me: