Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 无法强制转换类型为';UITableViewController';_Ios_Swift_Xcode_Segue - Fatal编程技术网

Ios 无法强制转换类型为';UITableViewController';

Ios 无法强制转换类型为';UITableViewController';,ios,swift,xcode,segue,Ios,Swift,Xcode,Segue,我一直收到这个错误消息 无法将“UITableViewController”类型的值强制转换为SecondViewController 我真的不知道,请帮忙 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { var destination = segue.destination as! SecondViewController destination.myString = outputNam

我一直收到这个错误消息

无法将“UITableViewController”类型的值强制转换为SecondViewController

我真的不知道,请帮忙

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     var destination = segue.destination as! SecondViewController
     destination.myString = outputName.text!
}
在“var”行上,但现在在覆盖“func行”上,我几乎不知道它是什么意思。

var destination = segue.destination as! SecondViewController
为了避免崩溃,您需要将类名
SecondViewController
设置为脚本中的目标vc

class SecondViewController:UITableViewController {}

我希望这能奏效。

所以我解决了它!我把第二个ViewController上的类标点错了,我忘了大写字母S

这意味着UITableViewController不是第二个ViewController。您想移动到SecondViewController,但要移动到UITableViewControllerinstead@AndreyChernukha什么?我写的东西真的一点都不可理解吗?所以我在UItableview中创建类来匹配SecondViewController。你的SecondViewController类的声明要到明天才能@AndreyChernukha
class SecondViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate,UITableViewDelegate,UITableViewDataSource {