在swift中以编程方式调用segue的sigabrt错误 [英] sigabrt error calling segue programatically in swift

查看:143
本文介绍了在swift中以编程方式调用segue的sigabrt错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS开发新手,目前正在尝试在选择 UITableViewController 中的单元格后以编程方式调用segue。虽然我已经在故事板中创建了segue并为其分配了一个标识符,但我仍然在重写的 didSelectRowAtIndexPath <中的 performSegueWithIdentifier 方法调用中收到sigabrt错误/ code>方法。任何帮助将不胜感激。

I am new to iOS development and am currently attempting to call a segue programmatically after a cell in a UITableViewController is selected. Although I already created the segue in my storyboard and assigned it an identifier, I still receive a sigabrt error at the performSegueWithIdentifier method call within an overridden didSelectRowAtIndexPath method. Any help would be greatly appreciated.

override func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) 
{
    self.performSegueWithIdentifier("toExerciseInfo", sender: self)
}


推荐答案

我意识到这是一个旧帖子,但它出现在谷歌搜索的顶部,我能够通过阅读评论来解决我的问题。只是为了向前付款......

I realize this is an old post, but it showed up at the top of a google search and I was able to solve my problem by reading the comments. Just to pay it forward...

当你从故事板到视图控制器的连接不良时,会出现这个问题。在我的情况下,我将一个按钮连接到插座,然后删除插座,留下悬空连接。通过ctrl +单击故事板中的视图,可视地检查列出的连接,然后删除不再有效的连接,我能够相当容易地修复它。我确定还有其他方法可以解决这个错误,但这对我有用。

This is a problem that can occur when you have a bad connection from your storyboard to the view controller. In my case, I'd connected a button to an outlet, then deleted the outlet, leaving a dangling connection. I was able to fix it fairly easily by ctrl+clicking the view in the storyboard, visually inspecting the connections listed, and then deleting the one that was no longer valid. I'm sure there are other ways to fix the error, but that's what worked for me.

这篇关于在swift中以编程方式调用segue的sigabrt错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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