hmw1015
hmw1015

Reputation: 51

sigabrt error calling segue programmatically in Swift

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)
}

Upvotes: 4

Views: 2656

Answers (2)

user1988824
user1988824

Reputation: 2957

This might help someone someday.

Make sure you call the segue on the main thread or it will crash (SIGABRT):

dispatch_async(dispatch_get_main_queue(), ^{
                [self performSegueWithIdentifier:@"customplayer" sender:self];
            });

Upvotes: -1

Will
Will

Reputation: 400

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...

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.

Upvotes: 3

Related Questions