0

I am in a situation exactly like this post, but for whatever reason, only one of my performSegueWithIdentifier:sender works.

I have a View Controller (embedded in a UINavigationController) with two buttons, Cancel and Done. When clicked I want Cancel to unwind to one screen, and Done to unwind to another screen; however, this only works with one of the two segues I have set up.

- (IBAction)clickedDone:(id)sender {
    [self performSegueWithIdentifier:@"unwindToHome" sender:self];
}

- (IBAction)clickedCancel:(id)sender {
    [self performSegueWithIdentifier:@"unwindToViewEntries" sender:self];
}

"unwindToHome" works fine while "unwindToViewEntries" does nothing. No error, no printing, nothing. If I switch the segues and buttons, "unwindToHome" will still work while "unwindToViewEntries" does nothing.

I have unwind methods in both ViewControllers I want to unwind to and there are no other actions attached to the buttons.

I find it really odd that only one works. I've looked them over several times and there is nothing different that I can see.

Thanks in advance for the help. If there are some more things I should check please let me know!

I've already looked at solutions for the following posts:

I've also tried removing the segues and re-adding them, as well as deleting and re-adding the entire view controller. Every time, the same behavior.

EDIT: I should also mention that I've tried adding other segues in different views and none of the new ones I add work. Only "unwindToHome" seems to work, and I can't figure out why.

Community
  • 1
  • 1
cohenadair
  • 2,072
  • 1
  • 22
  • 38
  • Have you made sure you've put the right identifier in the interface builder? – scb998 Oct 16 '14 at 00:19
  • Yes, checked several times. Even tried renaming them just to see. Nothing changed. If the identifiers were wrong it'd throw an exception anyway. – cohenadair Oct 16 '14 at 00:23
  • Did you check the value of `self.storyboard`? – Holly Oct 16 '14 at 00:35
  • I'm not quite sure where I'd check that, but it is the same value whether Cancel or Done is clicked. – cohenadair Oct 16 '14 at 00:38
  • You make the source of the segue the view controller rather than the button, I assume.... – Phillip Mills Oct 16 '14 at 01:22
  • Other obvious question: food you set a breakpoint to ensure the method is being called on button push? – Holly Oct 16 '14 at 01:22
  • Yes and yes. The method is definitely being called, just nothing is happening. The unwind also doesn't work if I attach it to a button rather than call it programmatically. The same thing happens. It's the exact same setup as the segue that works. I can't make sense of it. – cohenadair Oct 16 '14 at 01:32
  • In the storyboard make sure that both segues show that it is a push segues. Sometimes Xcode sets one the segues to modal – Yan Oct 16 '14 at 03:49
  • There's no option for that in an unwind segue; there's only "Identifier" and "Action". – cohenadair Oct 16 '14 at 05:09
  • @Yan I changed the segues from the "unwind-to" views to the "common" view to "Show" segues (which is the new push) and it worked, so thank you! If you add an answer I'll accept it. – cohenadair Oct 16 '14 at 05:29
  • Hi. I created the answer. Whenever you have a chance please accept it. Thank you! – Yan Oct 17 '14 at 14:14

1 Answers1

1

In the storyboard make sure that both segues show that it is a show (push) segues. There was a question earlier,which is a little bit different, that if you create two segues from the same button Xcode was setting one push the other modal.

Happy coding!

Yan

Yan
  • 3,533
  • 4
  • 24
  • 45
  • After this worked I did a little more searching and found this: http://stackoverflow.com/questions/25654941/unwind-segue-not-working-in-ios-8, which might be related. I feel like you should be able to present any number of segues you want to a view as model without problems. Like I said I could do one, but the second messed up. I now present them as popups which seems to have solved it for now. Thanks for the help! – cohenadair Oct 19 '14 at 16:06
  • I thought it was just an issue in xcode when connecting segues. I guess it is an actual bug in iOS. Thanks for the link. Very interesting. Have a good one! – Yan Oct 20 '14 at 21:09