0

我正在尝试获取获取结果的部分名称。

NSArray *testArray = [self.fetchedResultsController sections];
for (NSString *string in testArray){
    NSLog(@"%@", string);
}

像这样,我正在获取指针的内存位置。我怎样才能打印出实际的部分名称?

4

1 回答 1

2

里面的项sections不是NSStrings,是符合NSFetchedResultsSectionInfo协议的对象。协议定义了一个name属性,所以你需要这样做:

NSArray *testArray = [self.fetchedResultsController sections];
for (id <NSFetchedResultsSectionInfo> ri in testArray){
    NSLog(@"%@", ri.name);
}
于 2013-08-13T11:02:33.820 回答