问题
Simple segue that has worked for months performed with this command:
[self performSegueWithIdentifier:@"ExpirationWarningSegue" sender:self];
now yields this error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not perform segue with identifier 'ExpirationWarningSegue'. A segue must either have a performHandler or it must override -perform.'
What? It's a segue. I command-drag from one UIViewController to another in the storyboard. I'm not writing code for this. The segue is defined in the storyboard with this exact identifier.
Why does this happen now that I have upgraded to xcode 7 when it used to work just fine?
回答1:
The error message tells you exactly what the problem is:
'Could not perform segue with identifier 'ExpirationWarningSegue'. A segue must either have a performHandler or it must override -perform.'
This is a custom segue. Therefore it must implement perform.
A cool feature of Xcode 7 / iOS 9 is that you can use a custom segue even where you have already specified a push (show) segue or a present (modal) segue. In that case, your perform must call super to get the original behavior.
回答2:
See my comment here. It is a simple custom segue implementation in objC. Porting it to swift is trivial.
来源:https://stackoverflow.com/questions/33483261/simple-segue-not-working-in-xcode-7