执行segue与标识符不会在swift 2中工作 [英] perform segue with identifier wont work in swift 2

查看:249
本文介绍了执行segue与标识符不会在swift 2中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户登录应用程序时,我一直在使用此代码执行自定义segue:

I have been using this code to perform a custom segue when a user logs in to the application:

dispatch_async(dispatch_get_main_queue()){

                self.performSegueWithIdentifier("showSTPS", sender: self)

}

我目前在perpareForSegue中有这个代码(我不完全确定我是否需要它)

I currently have this code in my perpareForSegue (im not totally sure if i need it)

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?){
            if "showSTPS" == segue.identifier {
                }
}

我每次尝试执行segue时都会收到以下错误:

And I am getting the following error every time I try to perform the segue:

2015-08-31 11:56:28.998 ICEFLO [3858:651041] ***由于未捕获的异常'NSInternalInconsistencyException'终止应用程序,原因:'无法执行带标识符的segue'showSTPS' 。一个segue必须要有一个performHandler,否则它必须覆盖-perform。'

2015-08-31 11:56:28.998 ICEFLO[3858:651041] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not perform segue with identifier 'showSTPS'. A segue must either have a performHandler or it must override -perform.'

任何有关做什么的建议将不胜感激 - 请请注意,这是针对swift2 / ios9

Any suggestions on what to do would be greatly appreciated - please note that this is for swift2/ios9

-Yogi

推荐答案

确保在故事板中,segue类型未设置为自定义。如果您将其设置为自定义,则需要提供自己的自定义segue类。

Make sure that in your storyboard the segue type is not set to custom. If you set it to custom you'll need to provide your own custom segue class.

这篇关于执行segue与标识符不会在swift 2中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆