I have an app which has a sidebar menu (a UITableView) with different rows that are connected separately with the main view controller with a (push) Segue.
Only one of this doesn't work, so when I tap on it I recieve this message:
**** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainTabBarController topViewController]: unrecognized selector sent to instance 0x14880ce00'terminating with uncaught exception of type NSException*
In the SideBarViewController this is the part of the code that causes the crash:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSLog(@"[segue identifier]: %@",[segue identifier]);
if ([[segue identifier] isEqualToString:@"sync"]) {
MainViewController *mainViewSync= (MainViewController *)[[segue destinationViewController] topViewController];
mainViewSync.sync = 1;
}}
How can I fix That?