0
我有以下代码:IOS是有可能得到NSFetchedResultsController领域的数据,而无需铸造
if ([[frc objectAtIndexPath:indexPath] isKindOfClass:[Author class]])
return ((Author *)[frc objectAtIndexPath:indexPath]).name;
return ((Location *)[frc objectAtIndexPath:indexPath]).name;
FRC - NSFetchedResultsController
。
如何获得对象的相同字段的数据Author
和Location
?类不能知道作者和地点的存在。
我也试着这样做:
id <NSFetchedResultsSectionInfo> sectionInfo = m_arts.sections[indexPath.section];
id object = sectionInfo.objects[indexPath.row];
NSLog(@"%@", object[@"name"]); // Crash!!!
它属于codereview.stackexchange.com – Sauvage