user979331
user979331

Reputation: 11851

Objective-C 'Could not find a navigation controller for segue 'SegueIdentifier'

I have this error here:

'Could not find a navigation controller for segue 'SegueIdentifier'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

For this line of code:

- (void)viewDidLoad {

    [super viewDidLoad];

    [self performSegueWithIdentifier: @"SegueIdentifier" sender: self];


}

I dont understand because I do have my segue in the storyboard to a UINavigation Controller....Please help.

Upvotes: 1

Views: 486

Answers (1)

Paulw11
Paulw11

Reputation: 114783

You can only use a push segue if your source view controller is already managed by a UINavigationController. If it isn't then you need to use a segue such as modal or replace. The recommended approach is to use a show adaptive segue as this will work correctly regardless of whether your source is managed by a UINavigationController or not.

Upvotes: 2

Related Questions