Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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
Xcode 使用InstanceDeviceController传递数据_Xcode_Swift3 - Fatal编程技术网

Xcode 使用InstanceDeviceController传递数据

Xcode 使用InstanceDeviceController传递数据,xcode,swift3,Xcode,Swift3,我有这个代码,但是,我没有在第二个视图控制器中接收数据。。。我做错了什么 let storyboard = UIStoryboard(name: "PostSubmit", bundle: nil) let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController { let nc = UINa

我有这个代码,但是,我没有在第二个视图控制器中接收数据。。。我做错了什么

        let storyboard = UIStoryboard(name: "PostSubmit", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController {
            let nc = UINavigationController(rootViewController: vc)
            vc.filteredResult = filteredResult
        }
        self.present(nc, animated: false, completion: nil)

可能是因为您显示了错误的控制器
nc
您设置的值在块内,而在块外不可用

 let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController 
 let nc = UINavigationController(rootViewController: vc)
 vc.filteredResult = filteredResult 
 self.present(nc, animated: false, completion: nil)

在传递之前,先打印
filteredResult
。也许是零。是的,是的,伙计,谢谢你的帮助!!我真的很感激。看起来它总是那么小以至于我看不清楚。我今天真的为了这么小的东西撕碎了我的代码。lol@Denis欢迎朋友:)我的坏家伙,我想把这个问题贴出来。但是谢谢你的提醒。这方面的任何帮助都会很棒。它来自另一个在线来源,但我很难将其转换为swift3@Denis你想在这个问题上得到帮助吗?是的,如果可以的话。