ios - NSArray 信号传输

标签 ios uitableview nsarray sigabrt nsindexpath

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/

相关文章:

ios - Swift 错误域=NSURLErrorDomain 代码=-999 "cancelled"

objective-c - UIDatePicker Date 属性不会设置所选日期 - 而是给出当前日期

ios - UITableView 混合部分项目

ios - UITableViewCells 中的复选标记显示不正确

ios - 为什么在对键进行排序时出现错误 "Incompatible pointer types assigning to ' NSMutableArray *' from ' NSArray *'."?

ios - 我如何在 ios 中获得 GMT 时间?

ios - 从 Parse 对象设置 UIPickerView 中的选定行

ios - 重新加载数据后如何转到 UITableView 中的第一个单元格

ios - 如何查看使用 valueForKey 创建的 NSArray 是否为空

ios - NSArray、NSData、NSMutuableArray 中的对象大小限制?