Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS 9中单击推送通知后,转到特定的帖子/评论/配置文件_Ios_Objective C_Push Notification - Fatal编程技术网

在iOS 9中单击推送通知后,转到特定的帖子/评论/配置文件

在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 }

我在appdelegate.m中的didReceiveEmotentification函数中尝试了许多代码

- (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;
    

    `

    你想在应用程序运行时或应用程序处于后台或用户未使用你的应用程序时更改视图控制器吗?我想在用户单击推送通知后立即更改视图控制器当应用程序处于后台时,你想在应用程序运行时或应用程序处于后台时更改视图控制器吗用户没有使用你的应用程序?我想在用户单击推送通知后立即更改我的视图控制器,当应用程序处于后台时,它可以工作,但没有后退按钮,它没有导航栏也可以工作,但它没有后退按钮,它也没有导航栏