如何使用 NSMutableArray 准备 ForSegue?
NSMutableArray *theNews;
这是 prepareForSegue 代码
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSManagedObject *object = [[theNews objectAtIndex:indexPath.row] objectAtIndexPath:indexPath];
[[segue destinationViewController] setDetailItem:object];
}
}
如果我运行代码,我会收到此错误:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSDictionaryM objectAtIndexPath:]:无法识别的选择器发送到实例 0x81c0f40”