我有以下代码:
if ([[frc objectAtIndexPath:indexPath] isKindOfClass:[Author class]])
return ((Author *)[frc objectAtIndexPath:indexPath]).name;
return ((Location *)[frc objectAtIndexPath:indexPath]).name;
frc - NSFetchedResultsController
.
如何获取相同对象字段的数据Author
和Location
?类必须不知道 Author 和 Location 的存在。
我也尝试这样做:
id <NSFetchedResultsSectionInfo> sectionInfo = m_arts.sections[indexPath.section];
id object = sectionInfo.objects[indexPath.row];
NSLog(@"%@", object[@"name"]); // Crash!!!