I have a method called handleLocalNotification in my AppDelegate that runs when my application receives a notification. I need it to switch to tab 0 in my UITabBarController which contains a UITableview. Then I need it to click on the correct row of the table to show the record sent by the notification. All controllers are created in the storyboard, so I have no links to them in AppDelegate.
I added to my AppDelegate.h:
@class MyListViewController;
@interface iS2MAppDelegate : UIResponder <UIApplicationDelegate> {
MyListViewController *_listControl;
}
and for testing, I just put this in the didFinishLaunchingWithOptions method:
UITabBarController *tabb = (UITabBarController *)self.window.rootViewController;
tabb.selectedIndex = 0;
_listControl = [tabb.viewControllers objectAtIndex:0];
[_listControl.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:4 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionTop];
The tabBarController bit works the way I can get it to load on different tabs. The last 2 lines lead to failure. Did I get it right? Or do I need to use a different method? The reason for the failure:
UINavigationController tableView]: ,