回答

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

相關問題