回答

0

我在这类情况下我做的是

您可以检查是否launchOptions不是零didFinishLaunchingWithOptions作为

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值为零这里,你可以在DetailViewController使用它,但不要忘了做零后使用。

使用这种方式你BACK按钮应显示在DetailViewController

+0

这解决了我的问题。谢谢@Zubair – 2015-03-25 06:17:54

+0

很高兴帮助你:) – 2015-03-25 10:46:35

相关问题