NSString* year = [self.years objectAtIndex:[indexPath section]];
//get algorithms for that year
NSArray* algorithmSection = [self.algorithmNames objectForKey:year];
NSLog(@"%@", indexPath);
//get specific algorithm based on that row
cell.textLabel.text = [algorithmSection objectAtIndex:indexPath.row];
return cell;
无论出于何种原因,当我编译它时,都会收到 SIGABRT 错误。它发生在
cell.textLabel.text
行。错误:
2011-08-29 19:26:21.273 xxxxxxxxxxx[1431:b303] 2 个索引 [0, 0]
2011-08-29 19:26:21.274 xxxxxxxxxxxxx[1431:b303] -[__NSCFDictionary objectAtIndex:]: 无法识别的选择器发送到实例 0x4ba2370
2011-08-29 19:26:21.277 xxxxxxxxx[1431:b303] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFDictionary objectAtIndex:]:已发送无法识别的选择器实例 0x4ba2370' 终止调用抛出异常
最佳答案
你的 algorithmSection
变量,你的代码期望它是一个 NSArray
,实际上是一个 NSDictionary
,它不响应选择器 -objectAtIndex:
.
关于ios - NSArray 信号传输,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7237150/