在iOS 9中单击推送通知后,转到特定的帖子/评论/配置文件
我在appdelegate.m中的didReceiveEmotentification函数中尝试了许多代码在iOS 9中单击推送通知后,转到特定的帖子/评论/配置文件,ios,objective-c,push-notification,Ios,Objective C,Push Notification,我在appdelegate.m中的didReceiveEmotentification函数中尝试了许多代码 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { //Code }
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
//Code
}
但是没有像预期的那样起作用
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ProfileViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"profileIdentifier"];
controller.userID = @"123";
controller.userName = @"calvinsug";
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
[navigationController pushViewController:controller animated:YES];
[self.window.rootViewController presentViewController:controller animated:YES completion:NULL];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ProfileViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"profileIdentifier"];
controller.userID = @"123";
controller.userName = @"calvinsug";
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:controller];
self.window.rootViewController = navController;
`试试这个:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ProfileViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"profileIdentifier"];
controller.userID = @"123";
controller.userName = @"calvinsug";
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:controller];
self.window.rootViewController = navController;
`你想在应用程序运行时或应用程序处于后台或用户未使用你的应用程序时更改视图控制器吗?我想在用户单击推送通知后立即更改视图控制器当应用程序处于后台时,你想在应用程序运行时或应用程序处于后台时更改视图控制器吗用户没有使用你的应用程序?我想在用户单击推送通知后立即更改我的视图控制器,当应用程序处于后台时,它可以工作,但没有后退按钮,它没有导航栏也可以工作,但它没有后退按钮,它也没有导航栏