Reputation: 1883
Are there any tips and tricks for troubleshooting unwind segues?
I've had trouble with them not happening, or getting "unrecognized selector sent to instance 0x??????" errors. I've also gotten the warning “Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!”
Upvotes: 1
Views: 689
Reputation: 1883
If the segue isn’t happening at all, make sure that the destination view controller doesn’t have a canPerformUnwindSegueAction:
that is blocking it. It's a stupid error, but it happens if you don't have the proper logic for multiple segues.
If the unwind is breaking on something like "-[MyViewController unwindToLogin:]: unrecognized selector sent to instance 0x??????" then that implies you have a canPerformUnwindSegueAction:
that is saying YES when it shouldn’t. You should only have it say YES to segues that actually exist within the UIViewController
, because this could get called for ALL segues in the application, not just the ones in your view controller.
If you are getting the warning "Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!" then you are probably calling dismissViewControllerAnimated: completion:
within your unwind segue. This is not needed with iOS7 onward. Older documentation that has since been marked as obsolete recommended this. See https://stackoverflow.com/a/18906061/594602 for more information.
Upvotes: 5