Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.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
Multithreading 带performSegue的performSelectorOnMainThread_Multithreading_Swift_Segue - Fatal编程技术网

Multithreading 带performSegue的performSelectorOnMainThread

Multithreading 带performSegue的performSelectorOnMainThread,multithreading,swift,segue,Multithreading,Swift,Segue,我已经寻找了一段时间的答案,但还没有找到任何答案。我有一个这样的方法 dispatch_async(dispatch_get_main_queue()) { self.performSegueWithIdentifier("ShowNextView", sender: nil) } 是否可以通过某种方式使用performSelectorOnMainThread?正如我所看到的,performSelectorOnMainThreadon接受一个参数。您是否尝试将发送方设置为self而不是

我已经寻找了一段时间的答案,但还没有找到任何答案。我有一个这样的方法

dispatch_async(dispatch_get_main_queue()) {
    self.performSegueWithIdentifier("ShowNextView", sender: nil)
}

是否可以通过某种方式使用
performSelectorOnMainThread
?正如我所看到的,
performSelectorOnMainThread
on接受一个参数。

您是否尝试将发送方设置为self而不是nil

dispatch_async(dispatch_get_main_queue(),{
    self.performSegueWithIdentifier("ShowNextView",sender: self)
})
你试过这个吗

   let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
            dispatch_async(dispatch_get_global_queue(priority, 0)) {
                dispatch_async(dispatch_get_main_queue()) {
                        self.performSegueWithIdentifier("ShowNextView", sender: nil)
                }
            }

这是否回答了你的问题。。。你到底为什么要使用performSelectorOnMainThread?