Reputation: 3771
I'm trying to get section names of a fetched result.
NSArray *testArray = [self.fetchedResultsController sections];
for (NSString *string in testArray){
NSLog(@"%@", string);
}
Like this, I'm getting the memory locations for the pointers. How would I be able to print out the actual section names?
Upvotes: 0
Views: 53
Reputation: 726539
The items in sections
are not NSString
s, they are objects conforming to the NSFetchedResultsSectionInfo
protocol. The protocol defines a name
property, so you need to do this:
NSArray *testArray = [self.fetchedResultsController sections];
for (id <NSFetchedResultsSectionInfo> ri in testArray){
NSLog(@"%@", ri.name);
}
Upvotes: 2