Runtime Issue - "Nested push animation" when using the performSegueWithIdentifier function

I have a NavigationController in which there is a TableView. A TV cell has a โ€œmodalโ€ segment that points to a TableViewController (class: Details.h / .m). When I select a cell, I take it in the TableViewController, as expected.

However, I need to add the following functions:

1) click on the destination so that I get a good return button.
2) transmit various information about the object in the selected cell in the target TCEs.

To do this, I perform the following tasks:

1) Change segue to "push" and give it the identifier "segueToDetails"
2.1) add code to didSelectRowAtIndexPath method (below)

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self performSegueWithIdentifier:@"segueToDetails" sender:self]; } 

2.2) add code to prepareForSegue method (below)

 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow]; NSInteger rowNumber = selectedIndexPath.row; myObject = (MyObject *) [myArray objectAtIndex:rowNumber]; Details *details = [segue destinationViewController]; details.detailsObject = myObject; } 

2.3) to confirm that information about the object is transmitted to the recipient, I output some data using NSLog (below)

 - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"name: %@", detailsObject.name); } 

Now, when I start the project and select the cell in the table that I get in the target TCE, I see the result from NSLog, which is good. I also have a nice back button. But wait, when I press back, I have another back button! By pressing this button back, I will return to where I came from. The debugger window displays this message every time I go to the target TCE.

 2012-01-24 13:55:58.240 MyApp[26875:11603] nested push animation can result in corrupted navigation bar 012-01-24 13:55:58.593 MyApp[26875:11603] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. 2012-01-24 13:55:58.593 MyApp[26875:11603] Unbalanced calls to begin/end appearance transitions for <SpotDetails: 0x7a7a370>. 

Any suggestions to fix this?

PS - I am using Xcode 4.2 w / ARC, iOS 5

+4
source share
6 answers

If you have a modal indent in the storyboard, you do not need the code in the didSelectRowAtIndexPath: file. The storyboard does the rest. If you try to execute segue manually, and also get it in the storyboard, you will have problems.

+12
source

You double view the performance; once in the storyboard and once in the didSelectRowAtIndexPath file. When you connect segue in a storyboard, do not link it directly to the table cell, but rather to the view controller so that you can execute the segue program code, not the storyboard, doing this for you when you click on the cell.

+13
source

Have you redefined viewWillAppear / viewDidAppear / viewWillDisappear / viewDidDisappear ? Do you remember calling super from your override?

+3
source

I had segues that returned to my main navigation controller, which triggered this. I fixed the problem by setting the main navigation controller back to the top of the stack. Here is the code:

 - (void) viewDidAppear:(BOOL)animated { [self.navigationController popToRootViewControllerAnimated:NO]; } 
+1
source

I just want to add my solution to my problem in this thread if someone has the same problem as mine.

I copied the button and then connected it. It worked, but I got this error.

It turned out that I missed too canceling the old connection on the copied โ€œnewโ€ button, so I had two connections: new and old. Just deleted the old one and it worked.

0
source

I ran into this problem when I accidentally double clicked on the next viewController. This happened when I forgot to remove the push sega that I used for testing. Therefore, before anything else, check the stupid mistake if you double-clicked it.

0
source

Source: https://habr.com/ru/post/1392757/


All Articles