RBStoryboardLink icon indicating copy to clipboard operation
RBStoryboardLink copied to clipboard

Unwind does not work

Open xissburg opened this issue 10 years ago • 7 comments

It looks like unwind segues don't work with the new workflow. Since the destination is changed in -[RBStoryboardSegue initWithIdentifier:source:destination:] I get a 'Receiver (<UINavigationController: 0x109444040>) has no segue with identifier '<SegueName>' kind of error. If I modify the code to not change the destination view controller and perform the unwind segue on the RBStoryboardLink instance it works as expected. Also, the methods after the comment The following methods are important to get unwind segues to work properly. in RBStoryboardLink.m are never called.

xissburg avatar Jun 17 '14 03:06 xissburg

I too am having problems with unwinding. @xissburg can you provide the code you used to make this work? I tried your suggestion and had no luck. I'm not sure if it's because I'm doing this in swift or not.

oottinger avatar Aug 21 '14 10:08 oottinger

@oottinger https://github.com/xissburg/RBStoryboardLink/commit/45e8ebad1b35dbc9cdc8fbc46145508f3a2f36ed

xissburg avatar Aug 22 '14 02:08 xissburg

I would like to see a sample project of how to exploit this issue. The code fix shown just appears to disable view controller redirection, which eliminates the purpose of RBStoryboardSegue.

rob-brown avatar Aug 23 '14 17:08 rob-brown

That disables the mechanism that gets RBStoryboardLink out of the view controllers stack. Hence, in my prepareForSegue:sender: I have to do something like this:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"DumbSegue"]) {
        __weak RBStoryboardLink *storyboardLink = segue.destinationViewController;
        UINavigationController *navigationController = (UINavigationController *)storyboardLink.scene;
        RSDumbViewController *dumbViewController = navigationController.viewControllers[0];
        // Configure view controller...
    }
}

xissburg avatar Aug 25 '14 14:08 xissburg

Any fix for this?? Our unwinds are broken in iOS 8 also.

ghost avatar Sep 10 '14 01:09 ghost

I don't have a sample project exploiting this issue yet, and I don't have time to explore this issue on my own right now.

rob-brown avatar Sep 10 '14 16:09 rob-brown

I noticed I was getting some console messages associated with this issue:

Presenting view controllers on detached view controllers is discouraged

It seems that if you perform a segue inside of a UIViewController that's directly owned by RBStoryboardLink, in some cases, the view controller doesn't get correctly attached into the view controller hierarchy and unwind segues break.

The trick for me was to perform a segue only in viewDidAppear or later. Not the best solution, but that's what worked for me.

exhaze avatar Sep 13 '14 06:09 exhaze