通知到达时显示来自 AppDelegate 的视图控制器

Showing view controller from AppDelegate when notification arrived

我想显示 UIViewController,它位于 UIStoryboard 内。弹出视图没有任何问题。但是导航在弹出窗口中不起作用viewcontroller;比如当我触摸后退按钮

 [self.navigationController popViewControllerAnimated:YES];

我在 AppDelegate 中使用该代码 --> didReceiveRemoteNotification 方法

 UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
 PFProfileInfoVC *viewcontroller = [mystoryboard instantiateViewControllerWithIdentifier:@"SBID_ProfileVC"];
 viewcontroller.strAuthorID = [userInfo objectForKey:@"aps"][@"targetId"];
 [self.window.rootViewController presentViewController:viewcontroller animated:YES completion:nil];

谢谢,

当您使用 presentViewController 时,viewController 不会被推送到导航堆栈。通常,它是模态呈现的。所以如果你想关闭它,使用

 [self dismissViewControllerAnimated:true completion:nil];