For logging navigation between controllers, I use swizzling of -popViewControllersAnimated: method. And sometimes it causes strange crash with EXC_BAD_ACCESS. What can be the reason?
- (void)sw_popViewControllerAnimated:(BOOL)animated {
//1. get top controller before pop
//2. pop
//3. get top controller after pop
//4. log it
NSString *controllerFromIdentifier = @"";
__block NSString *controllerToIdentifier = @"";
NSDictionary *controllerFromAdditionalParams = @{};
UIViewController *topController = ((UINavigationController*)self).topViewController;
[self sw_popViewControllerAnimated:animated];
UIViewController *topControllerAfterPop = ((UINavigationController*)self).topViewController;
}