Hi Claude,
Sorry for the lack of information provided, here a link to a diagram that made show to the overview of my storyboard
https://drive.google.com/file/d/1Jpt38FRSBhTo4LcMEDQARA1Of94IxHLj/view?usp=sharing
To better explain my current scenario, I have a Navigation Controller as my InitialVC this navigation handles the Login and Signup VC, once user is successfully login the screen will segue to a ServicesTableViewController. When a cell is tapped in the TVC, the TabBarController will show. My Tab Bar Controller has 5 VC: Home, Bill, Usage, Shop and Support
To answer you question above, the hierarchy is this:
Navigation Controller LoginEnrollVC EnrollVC LoginVC ServicesTVC TabBarController
- HomeVC Bill VC - PaymentAccountVC - AddCardVC - PaymentSuccessVC
- Usage VC Shop VC
- SupportVC
The issue at hand is when I reached PaymentSuccessVC and try to go back to my TabBarController:Home that's is whey the error message started to appear.
My Payment Success VC has a button that shows, Go Back To Home and that is where I put this portion of the code:
let controllers = self.navigationController.viewcontrollers
let homeTBC = controllers![3] as! UITabBarController
let homeVC = homeTBC.viewControllers?[0] as! HomeViewController
self.present(homeVC, animated: true, completion: nil)
but when I try clicking that button, it's showing this error message:
terminating with uncaught exception of type NSException
Here's some additional screenshot of my story board for more reference:
https://drive.google.com/file/d/1yp-tnKqwSu7rcccLoBttlPzD6FlODdZK/view?usp=sharing
https://drive.google.com/file/d/1O0gNE1G-2kB44j77pmIWgRwPD8Gr3lA4/view?usp=sharing
https://drive.google.com/file/d/1Rr6uJaEmA_VD8kEKPnsvwXbBnNlT5-et/view?usp=sharing
https://drive.google.com/file/d/18T2VUg-OVm7Qdvw-Dx80hdH72UTYJuD_/view?usp=sharing
https://drive.google.com/file/d/1V68CPJG7Bn4TbPvcMrnjVsyKo9xOaat4/view?usp=sharing
Thank you so much in advance