Skip to content

Commit

Permalink
IOS-109: Terminating app due to uncaught exception 'NSInvalidArgument…
Browse files Browse the repository at this point in the history
…Exception' - Pushing controller more than once
  • Loading branch information
Tauseef Mughal committed Jun 17, 2015
1 parent ee42618 commit f897e61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions AlfrescoApp/Utils/UniversalDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ + (void)pushToDisplayViewController:(UIViewController *)viewController usingNavi
}
else
{
if (viewController.navigationController)
{
NSArray *navigationStackControllers = viewController.navigationController.viewControllers;
NSMutableArray *mutableNavigationStackControllers = viewController.navigationController.viewControllers.mutableCopy;
[navigationStackControllers enumerateObjectsUsingBlock:^(UIViewController *currentController, NSUInteger idx, BOOL *stop) {
if (currentController == viewController)
{
[mutableNavigationStackControllers removeObject:currentController];
}
}];
viewController.navigationController.viewControllers = mutableNavigationStackControllers;
}

[navigationController pushViewController:viewController animated:animated];
}
}
Expand Down

0 comments on commit f897e61

Please sign in to comment.