I'm pretty new to programming, I'm working on an app with a UITabBarController
I want to open another app when one of the Tab Bar Items is selected. I put the code in the viewDidLoad, and when I start the app and click on the Tab Bar item for the first time it works great, but after that when I click on it again without restarting the app nothing happens.
I have tried using tabBarController didSelectViewController, and tabBar didSelectItem to try and fix this. But can not seem to get them to work. Is this a lost cause, or am I just missing something, or not putting them in the right place?
Code:
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
if (tabBarController.selectedIndex == 2) {
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"mswxmedia://"]];
}
}