Completion of navigation in an unexpected state. Navigation bar visibility tree may be damaged

I have two different clicks on a view control button as shown below:

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{  

     indexPathRow = indexPath.row;  

     NSLog(@"indexPathRow.%d", indexPathRow);  

    safetyInventoryList.recordIdToEdit = [DeviceIdArray objectAtIndex:indexPathRow] intValue];  

    NSLog(@"Item selected..%d", inventoryList.recordIdToEdit);  

    [self performSegueWithIdentifier:@"DetailsViewController" sender:nil];  

}  



 -(IBAction)ViewScoreBtn:(id)sender {  

     [self performSegueWithIdentifier:@"ScoreViewController" sender:nil];  

 }  

      

I am getting the following error and black screen when I press the back button after entering the viewcore -> VC button.

nested push animation can result in corrupted navigation bar  
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.  
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview'  

      

Updated code: in preparation for the segue, I have the following (in my VC view) :(. M)

 if([segue.identifier isEqualToString:@"ScoreViewController"]){  
        ScoreViewController *destViewController = segue.destinationViewController;  
        destViewController.delegate = self;  
    }  

      

and

 - (void)dismissScoreViewController:MVVMScoreViewController{  
    [self dismissViewControllerAnimated:YES completion: nil];  
 }  

      

in my submitted VC (.h & .m):

@protocol dismissScoreDelegate <NSObject>  

 - (void)dismissScoreViewController:SafetyDeviceViewController;  

@end  
 @property (nonatomic, assign) id<dismissScoreDelegate> delegate;  

 -(void) viewWillDisappear:(BOOL)animated {
    if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
        // Navigation button was pressed. Do some stuff
        [self.delegate dismissScoreViewController];
     }
   [super viewWillDisappear:animated];
 }  

      

So what went wrong?

+3


source to share


2 answers


1.comment the execution of the command causing this error

2.run the project

3. Press the button / action from which it is intended to navigate



4.Check for duplication or run multiple sessions.

I got this due to multiple segue activity from one button action.

0


source


Use unind segue instead of pop, it will work fine



0


source







All Articles