I have an unwind segue that was working fine until I upgraded to iOS 9/XCode 7.
Here's a screenshot of the Storyboard config for the unwind segue:
The unwind segue is triggered off of pushing a "Done" button in the UINavigationController. I intercept that action by overriding the canPerformUnwindSegueAction in a UITableViewController contained in the UINavigationController. I do this to validate data. If the data is incomplete I return YES to prevent the segue from unwinding completely.
The segue actually does unwind to the correct terminated method (in the NotificationsViewController); canPerformUnwindSegueAction just never gets called for some reason.
I've tried:
- Deleting and adding the unwind segue in the Storyboard.
- Overriding UITableViewController with my own custom ViewController that includes the canPerformUnwindSegueAction. (along the lines of this post Unwind Segue not working in iOS 8)
- Same as #2 overriding allowedChildViewControllersForUnwindingFromSource. (allowedChildViewControllersForUnwindingFromSource doesn't get called on the original UITableViewController either)
- Retargeting iOS 8.2 (the last working version) but that doesn't work either. When upgrading to iOS 9 I noticed that Xcode made over 80 changes to the .storyboard file...maybe something broke there?
Here's a backtrace that shows what happens when the "Done" button is pushed:
*** First throw call stack:
(
0 CoreFoundation __exceptionPreprocess + 165
1 libobjc.A.dylib objc_exception_throw + 48
2 CoreFoundation -[__NSDictionaryM setObject:forKey:] + 1042
3 Autodar -[Notification JSONDictionary] + 608
4 Autodar -[RESTClient createNotification:withCompletionBlock:] + 290
5 Autodar -[NotificationsViewController createBackendNotification:atIndex:] + 247
6 Autodar -[NotificationsViewController unwindFromDone:] + 705
7 UIKit -[UIStoryboardUnwindSegueTemplate _performWithDestinationViewController:sender:] + 214
8 UIKit -[UIStoryboardUnwindSegueTemplate _perform:] + 86
9 UIKit -[UIStoryboardSegueTemplate perform:] + 156
10 UIKit -[UIApplication sendAction:to:from:forEvent:] + 92
11 UIKit -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 152
12 UIKit -[UIApplication sendAction:to:from:forEvent:] + 92
13 UIKit -[UIControl sendAction:to:forEvent:] + 67
14 UIKit -[UIControl _sendActionsForEvents:withEvent:] + 327
15 UIKit -[UIControl _sendActionsForEvents:withEvent:] + 706
16 UIKit -[UIControl touchesEnded:withEvent:] + 601
17 UIKit -[UIWindow _sendTouchesForEvent:] + 835
Here's where I override canPeformUnwindSegueAction in my UITableViewController:
// Respond to "Done" button being pushed
// Return:
// YES: to stop unwind and display popover for validation message
// NO: to unwind back to NotificationsViewController
- (BOOL)canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender {
// return YES if data is incorrect
return NO;
}
I'm stumped. Any ideas as to what I could do to further diagnose or resolve this would be greatly appreciated!