我正在使用 Objective-C,我想为另一个 View Controller 复制一个数组并推送它。这是我的代码:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"comment"]){
commentViewController *vc = segue.destinationViewController;
vc.comments = [[NSArray alloc]initWithArray:comments];
}
}
但它不起作用。我在 Xcode 中得到了这个:
2015-12-06 16:27:45.802 net[1244:29117] -[UIViewController setComments:]: 无法识别的选择器发送到实例 0x7ff8d34eb720 2015-12-06 16:27:45.807 net[1244:29117] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIViewController setComments:]: 无法识别的选择器发送到实例 0x7ff8d34eb720”
有人可以帮助我吗?
最佳答案
关于ios - 无法将数据设置为 prepareForSegue 中的数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34115506/