title: -segueForUnwindingToViewController: fromViewController: identifier: not being called
body: <p>I have created a custom segue that presents a view controller inside a container that is very similar with Apple's own modal view controllers (I've implemented it as a UIViewController subclass).</p>
  
  <p>I'm now trying to create a custom unwind segue but there's no way I can get the method <code>-segueForUnwindingToViewController: fromViewController: identifier:</code> to be called.</p>
  
  <p>I've also implemented <code>-viewControllerForUnwindSegueAction: fromViewController: withSender:</code> on my container so I can point to the correct view controller (the one that presented this modal) but then the method that should be asked for my custom unwind segue doesn't get called anywhere.</p>
  
  <p>Right now, the only way for me to dismiss this modal is to do it on the <code>-returned:</code> method.</p>
  
  <p>Did anyone could successfully do this with a custom unwind segue?</p>
  
  <hr>
  
  <p><strong>EDIT:
  A little bit more code and context</strong></p>
  
  <p>My unwind view controller is configured in the storyboard, not programatically.</p>
  
  <p>I have these pieces of code related to the unwind segues in my controllers:</p>
  
  <p><em>PresenterViewController.m</em></p>
  
  <p>I'm using a custom method to dismiss my custom modals here (<code>-dismissModalViewControllerWithCompletionBlock:</code>).</p>
  
  <pre><code>- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController
                                        fromViewController:(UIViewController *)fromViewController
                                                identifier:(NSString *)identifier {
      return [[MyModalUnwindSegue alloc] initWithIdentifier:identifier
                                                     source:fromViewController
                                                destination:toViewController];
  }
  
  -(IBAction)returned:(UIStoryboardSegue *)segue {
      if ([segue.identifier isEqualToString:@"InfoUnwindSegue"]) {
          [self dismissModalViewControllerWithCompletionBlock:^{}];
      }
  }
  </code></pre>
  
  <p><em>MyModalViewController.m</em></p>
  
  <p>Here I only use <code>-viewControllerForUnwindSegueAction: fromViewController: withSender:</code> to point to the view controller that I should be unwind to.</p>
  
  <pre><code>- (UIViewController *)viewControllerForUnwindSegueAction:(SEL)action 
                                        fromViewController:(UIViewController *)fromViewController 
                                                withSender:(id)sender {
      return self.myPresentingViewController;
  }
  </code></pre>
  
  <p>The behavior I was expecting was that MyModalViewController was called to point to the view controller that should handle the unwinding and then this view controller had his <code>-segueForUnwindingToViewController: fromViewController: identifier:</code> method called before <code>-returned:</code> gets called.</p>
  
  <p>Right now <code>-segueForUnwindingToViewController: fromViewController: identifier:</code> never gets called.</p>
  
  <p>I must also say that I already tried different configurations. Everywhere I put my method to return the unwind segue it never gets called. I've read that I can subclass a navigation controller and then it gets called but I don't know how it would fit in my solution.</p>
  
  <hr>
  
  <p><strong>EDIT 2: Additional info</strong></p>
  
  <p>I've checked that MyModalViewController has his <code>-segueForUnwindingToViewController: fromViewController: identifier:</code> method called when I want to dismiss a regular modal view controller presented by it. This may be because he's the top most UIViewController in the hierarchy.</p>
  
  <p>After checking this I've subclassed UINavigationController and used this subclass instead to contain my PresenterViewController. I was quite surprised to notice that his <code>-segueForUnwindingToViewController: fromViewController: identifier:</code> method is called as well.</p>
  
  <p>I believe that only view controllers that serve as containers have this method called. That's something that makes little sense for me as they are not the only ones presenting other view controllers, their children are also doing so.</p>
  
  <p>It's not OK for me to create logic in this subclass to choose which segue class to use as this class has no knowledge of what their children did.</p>
  
  <p>Apple forums are down for the moment so no way to get their support right now. If anyone has any more info on how this works please help! I guess the lack of documentation for this is a good indicator of how unstable this still is.</p>