我尝试在点击本地通知时打开特定的视图控制器,如果应用在后台,我无法执行此操作,因为我在[launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
方法中没有applicationDidBecomeActive
。如果可以,请提供帮助,提前致谢。
答案 0 :(得分:1)
喜欢
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
yourViewController *obj=[storyboard instantiateViewControllerWithIdentifier:@"yourViewControllerStoryboardID"];
// [self.window.rootViewController.navigationController pushViewController:obj animated:YES];
self.window.rootViewController = obj;
<强>更新强>
- (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 强>
您可以在此处获取本地通知操作
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
有关完整教程,请参阅this