NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController

后端 未结 11 673

so I\'m making an app with 5 view controllers, the first is embedded in a UINavigationController and the segue between the first 4 view controllers works fine. However intro

相关标签:
11条回答
  • 2020-12-07 18:00

    in my particular case, the place to call into a subset of views that required a push was only from code and was not connectable via IB. The original project to create the subset of views was started with a dedicated button and thus was IB'able.

    No segue was configurable, and thus any push resulted in this error.

    My solution was simple: [self showViewController:targetViewController sender:self];

    0 讨论(0)
  • 2020-12-07 18:00

    If your application has navigation controller as root view controller of window ,select storyboard file and then select the corresponding navigation controller , in Simulated Metrics select Is Initial View Controller checkbox. This worked for me. Hope this helps.

    0 讨论(0)
  • 2020-12-07 18:07

    In my case at the time the original VC performed the segue, the Navigation Controller was transitioning and already changed he visible VC.

    I solved it by doing:

    if (self.navigationController.visibleViewController == self) {
        [self performSegueWithIdentifier:@"thankyou" sender:self];
    }
    

    no more crash. :)

    0 讨论(0)
  • 2020-12-07 18:09

    I had the same problem as you had.

    My problem was that I was calling the identifier of a segue that wasn't accessible from within the class I was calling the segue from. I solved it by adding another segue directly to the view from the ViewController that had access to the class I was working in. Hope this helps.

    0 讨论(0)
  • 2020-12-07 18:11

    Set UINavigationcontroller as Initial View controller (Initial Scene) in StoryBoard.

    0 讨论(0)
  • 2020-12-07 18:13

    if you are using UIViewController class

    then check one thing in the declaration of segue identifier for example, you have set

    Identifier:MySegue1 Segue:Present Modally (choose this if you are using UIViewController Class)

    Presentation: Default Transition: Default

    and check one more thing that your object deceleration is correct

    Maybe my answer is not exactly correct,but this is what all i get to know abut this error. hope it will help you lil bit.

    0 讨论(0)
提交回复
热议问题