Search code examples
objective-cxcode5segueuistoryboardseguensexception

Navigation Bar subview tree might get corrupted issue


i am trying to send the view to next view but when i try to come back to the root page it crashes and say that Navigation Bar subview tree might get corrupted issue

 - (IBAction)nxtBtn:(id)sender {

        //here i am sending it to next view...
            [self performSegueWithIdentifier:@"next" sender:(id)sender];

        }
    //function for segue
        -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
        {
              //next is the name of the identifier

            if ([segue.identifier isEqualToString:@"next"]) {
                nextViewController *vc=(nextViewController *)segue.destinationViewController;
                vc.str=sender;
            }


        }

Solution

  • we don't need any kind of identifier for simple use of segue i.e. navigating from one view to another without passing any data. just simple as that you have to connect the segue from one view to other and run the application. it will work properly.