Reputation: 593
I am trying to open a specific view controller on click of local notification, if app is in background, i am unable to do that because i don't have [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
in applicationDidBecomeActive
method. Please help if you can, Thanks in advance.
Upvotes: 0
Views: 1273
Reputation: 82759
do like
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
yourViewController *obj=[storyboard instantiateViewControllerWithIdentifier:@"yourViewControllerStoryboardID"];
// [self.window.rootViewController.navigationController pushViewController:obj animated:YES];
self.window.rootViewController = obj;
Update
- (void)applicationDidBecomeActive:(UIApplication *)application {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
MapViewController *obj=[storyboard instantiateViewControllerWithIdentifier:@"Map"];
// [self.window.rootViewController.navigationController pushViewController:obj animated:YES];
self.window.rootViewController = obj;
}
Update1
you can get the localnotification action in here
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
for complete tutorial see this
Upvotes: 1