我一直在尝试将数据从一个 tableViewController 传递到另一个 tableViewController,但是一旦我为第二个 tableViewController 中的属性赋值,应用程序就会崩溃,给我消息“...无法识别的选择器已发送到实例 0x715c340 ……”。 这是我使用的代码:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"displayWordlist"]){
DisplayWordlist *dwl = (DisplayWordlist *)[segue destinationViewController];
dwl.apa = @"hej";
}
}
一旦程序到达 'dwl.apa = @"hej";'它崩溃了。我既做了apa的一个属性,又合成了。
最佳答案
确保您已将此 View Controller 的类设置为 Storyboard 中的 DisplayWordlist。如果不这样做,dwl 将被假定为 UIViewController 的一个实例,尽管进行了强制转换。
关于ios - 在 prepareForSegue :sender 中传递数据时,iPhone 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15342767/