主题 1:在 swift 中用 segue 发出 SIGABRT 信号 [英] Thread 1: Signal SIGABRT with segue in swift

查看:30
本文介绍了主题 1:在 swift 中用 segue 发出 SIGABRT 信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个tableview.我正在尝试制作一个简单的应用程序,当我得到第三个 tableView 这个错误线程 1 信号 SIGABRT"并且应用程序不会在 iOS 模拟器中打开时,添加更多视图后.错误指向这行代码:

让 VC :DetailCityTableViewController = segue.destinationViewController as!DetailCityTableViewController

并显示错误:

 无法将UITableViewController"(0x102af47f8)类型的值转换为balen.DetailCityTableViewController"(0x1013d7560).(lldb)

<块引用>

完整代码:

tableview2 传递给 tableView3

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {让路径:NSIndexPath = self.tableView.indexPathForSelectedRow!if segue.identifier == "DetailCitySegue" {让 VC :DetailCityTableViewController = segue.destinationViewController as!DetailCityTableViewControllerVC.urlDetailCity = urlDetail!//传递 url 城市VC.cityIdSelectet = cityId[path.row]//传递选择的CountryID打印(cityId [path.row])}}

我是,我认为问题在于 segue .你怎么看?

解决方案

不,问题是 '

<块引用>

无法将 'UITableViewController' (0x102af47f8) 类型的值转换为'balen.DetailCityTableViewController''

您没有在界面构建器中将视图控制器的类类型更改为 DetailCityTableViewController,或者 segue 的目的地与您想象的不同.

I have several tableview. I am trying to make a simple application and after adding more view when I get the third tableView this error "Thread 1 Signal SIGABRT" and the app wont open in iOS Simulator. The error points to this line of code:

let VC :DetailCityTableViewController = segue.destinationViewController as! DetailCityTableViewController

and display error :

 Could not cast value of type 'UITableViewController' (0x102af47f8) to 'balen.DetailCityTableViewController' (0x1013d7560).
(lldb)  

Full Code :

tableview2 pass to tableView3

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    let path : NSIndexPath = self.tableView.indexPathForSelectedRow!

    if segue.identifier == "DetailCitySegue" {

        let VC :DetailCityTableViewController = segue.destinationViewController as! DetailCityTableViewController
        VC.urlDetailCity = urlDetail!// pass url city

        VC.cityIdSelectet =  cityId[path.row] //pas CountryID selected

        print(cityId[path.row])
    }           
}

I am , I think the problem is segue .What do you think?

解决方案

No, the problem is '

Could not cast value of type 'UITableViewController' (0x102af47f8) to 'balen.DetailCityTableViewController''

You didn't change the class type of the view controller to DetailCityTableViewController in interface builder or the segue has a different destination than you think.

这篇关于主题 1:在 swift 中用 segue 发出 SIGABRT 信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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