Swift PrepareForSegue ERROR线程1:EXC_BREAKPOINT(代码= EXC_ARM_BREAKPOINT,子代码= 0xdefe

时间:2015-01-15 23:16:09

标签: multithreading swift

当我尝试编译PrepareForSegue函数时,我遇到了很大的问题:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
    if segue.identifier == "findMap" {
        let MapViewController = segue.destinationViewController as UIViewController
        if sender as UITableView == self.searchDisplayController!.searchResultsTableView {
            let indexPath = self.searchDisplayController!.searchResultsTableView.indexPathForSelectedRow()!
            let destinationTitle = filteredDepartments[indexPath.row].name
            MapViewController.title = destinationTitle
        } else {
            let indexPath = self.tableView.indexPathForSelectedRow()!
            let destinationTitle = departments[indexPath.row].name
            MapViewController.title = destinationTitle
        }
    }
}

错误在“陷阱”-row:

的“线程”部分中打开

- > 0x2f6e18:陷阱

,错误代码如上:

- >线程1:EXC_BREAKPOINT(代码= EXC_ARM_BREAKPOINT,子代码= 0xdefe

我认为错误就在这一行:

if sender as UITableView == self.searchDisplayController!.searchResultsTableView {

Bur我不知道如何解决它,所以请帮助我......

1 个答案:

答案 0 :(得分:0)

很难说出你的代码应该是什么意思,但我的猜测是你的意思是:

if sender === self.searchDisplayController!.searchResultsTableView {

请注意,使用三等于运算符表示“与对象相同”。