Push notification ios-SWRevealViewController在收到推送通知时转到导航控制器中的最后一个视图
我正在我的项目中使用SWRevealViewController 2.3.0。我的故事板设计如下: 当应用程序未运行(完全终止)且出现推送通知时,如何让详细视图控制器显示,并使用返回按钮返回主视图控制器?某些通知值应已传递到详细信息视图Push notification ios-SWRevealViewController在收到推送通知时转到导航控制器中的最后一个视图,push-notification,segue,appdelegate,swrevealviewcontroller,Push Notification,Segue,Appdelegate,Swrevealviewcontroller,我正在我的项目中使用SWRevealViewController 2.3.0。我的故事板设计如下: 当应用程序未运行(完全终止)且出现推送通知时,如何让详细视图控制器显示,并使用返回按钮返回主视图控制器?某些通知值应已传递到详细信息视图 谢谢你的帮助。我在这种情况下所做的是 您可以检查launchOptions是否不是nildidfishlaunchwithoptionsas if (launchOptions) { NSDictionary *dic = [launchOptions
谢谢你的帮助。我在这种情况下所做的是 您可以检查
launchOptions
是否不是nildidfishlaunchwithoptions
as
if (launchOptions)
{
NSDictionary *dic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
[[NSUserDefaults standardUserDefaults] setObject:[dic objectForKey:@"aps"] forKey:@"PushNotification"];
}
else
{
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"PushNotification"];
}
并像我一样保存在用户默认值中
现在,只要在mainViewController
中,您就可以按如下方式检查它
NSDictionary *notification = [[NSUserDefaults standardUserDefaults] objectForKey:@"PushNotification"];
if (notification)
{
// check the dictionary "Push Notification" Key Values that you are receiving to go in `DetailViewController`
// Now go to `DetailViewContoller` having your details from `PushNotification`by `performSegueWithIdentifier`
[self performSegueWithIdentifier:@"DetailViewController" sender:self];
// make this value nil for normal use
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"PushNotification"];
}
如果您没有在这里将这个userDefaults值设为nil,您也可以在DetailViewController中使用它,但不要忘记在使用后将其设为nil
使用这种方式,您的后退按钮应该显示在DetailViewController中