Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.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 Swift-无法触发segue_Ios_Swift_Segue - Fatal编程技术网

iOS Swift-无法触发segue

iOS Swift-无法触发segue,ios,swift,segue,Ios,Swift,Segue,我有下面的代码,当用户注册时会显示一个警告框。在用户与警报框按钮交互(即,让我们走)后,我现在需要触发一个名为someSegue的序列,以便将用户重定向到登录页面 用户单击“警报框”按钮后,不会发生任何事情。我错过了什么?那是自我吗?如果我删除self,它将不工作,xcode会抱怨 user.signUpInBackgroundWithBlock { (succeeded, error) -> Void in

我有下面的代码,当用户注册时会显示一个警告框。在用户与警报框按钮交互(即,让我们走)后,我现在需要触发一个名为someSegue的序列,以便将用户重定向到登录页面

用户单击“警报框”按钮后,不会发生任何事情。我错过了什么?那是自我吗?如果我删除self,它将不工作,xcode会抱怨

user.signUpInBackgroundWithBlock {
                    (succeeded, error) -> Void in
                    if error == nil {
                        // Hooray! Let them use the app now.

                        let delay = 4.5 * Double(NSEC_PER_SEC)
                        let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
                        dispatch_after(time, dispatch_get_main_queue()) {
                            actInd.stopAnimating()
                            var alert = UIAlertController(title: "Congratulations!", message: "Your account was successfully created! You will be required to login with your credentials.", preferredStyle: UIAlertControllerStyle.Alert)
                            alert.addAction(UIAlertAction(title: "Let's Go!", style: UIAlertActionStyle.Default, handler: nil))
                            self.presentViewController(alert, animated: true, completion: nil)
                            self.performSegueWithIdentifier("someSegue", sender: self)
                        }



                    } else {
                        // Show the errorString somewhere and let the user try again.
                    }
                }

如果要在按下警报按钮后执行代码块,则需要在addAction方法的处理程序参数中传递该代码块

alert.addAction(UIAlertAction(title: "Let's Go!", style: UIAlertActionStyle.Default, handler: { (action: UIAlertAction!) in
       self.performSegueWithIdentifier("someSegue", sender: self)   
    }))
尝试在调度\u异步调度\u获取\u主队列,{}内调用PerformsgueWithIdentifier