Push-Ansicht von Push-Benachrichtigung

Ich erhalte meine Benachrichtigungen erfolgreich für iOS 5. Ich möchte Benutzer zu einer bestimmten Ansicht senden können, wenn sie über die Push-Benachrichtigung im Benachrichtigungscenter streichen oder darauf tippen.

Der View-Controller (View), zu dem der Benutzer gehen soll, ist der "groceryStoreViewController". Ich habe gelesen, dass dies in didFinishLaunchingWithOptions oder didReceiveRemoteNotification erfolgt, bin mir aber nicht sicher.

Wenn jemand weiß, wie man das macht, würde ich es wirklich begrüßen, da es wirklich ein Kampf war.

Vielen Dank

BEARBEITEN

Das Problem ist also, dass ein bestimmter Ansichtscontroller geöffnet werden soll, wenn der Benutzer auf eine Benachrichtigung tippt, aber auch, dass die UITabBar erhalten bleibt. Ich war nicht erfolgreich in der Lage, dies zu tun, und es hat etwas damit zu tun, dass ich die Unteransicht anzeige, die ich glaube. Bitte lassen Sie mich wissen, was Sie denken und vielen Dank.

<code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

self.tabBarItem = [[[UITabBarItem alloc] init] autorelease];

 exploreViewController *view1 = [[exploreViewController alloc] initWithNibName:@"exploreViewController" bundle:nil];
view1.title= @"Explore";

Upcoming *view2 = [[Upcoming alloc] initWithNibName:@"Upcoming" bundle:nil];
view2.title = @"Upcoming";

TipsViewController *view3 = [[TipsViewController alloc] initWithNibName:@"TipsView" bundle:nil];
view3.title = @"Tips";

UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1];
UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:view2];
UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:view3];

[view1 release];
[view2 release];
[view3 release];

self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nil];
self.tabBarItem = [[[UITabBarItem alloc] init] autorelease];

[nav1 release];
[nav2 release];
[nav3 release];


if (launchOptions != nil)
{  
NSDictionary *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(@"Launched from push notification");
//Accept push notification when app is not open
if (remoteNotif) {      

 NSDictionary *alertBody = [remoteNotif objectForKey:@"loc-key"];

 self.window.rootViewController = nav2;  //this is what I want displayed when tapped but also maintain tab bar controller
    [window addSubview:tabBarController.view];
    [window makeKeyAndVisible];

  }
}
else {

    //Go here if just loading up normally without push
    [window addSubview:tabBarController.view];
    [window makeKeyAndVisible];

}
  return YES;

}
</code>

Antworten auf die Frage(1)

Ihre Antwort auf die Frage