Push Notification soll einen bestimmten View im Storyboard öffnen

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Push Notification soll einen bestimmten View im Storyboard öffnen

    Hallo,

    habe seit einigen Tagen ein Problem was ich irgendwie nicht hin bekomme. Ich möchte in meiner Anwendung, wenn diese eine Push Notification erhält, einen Alert View öffnen. Der Anwender soll nach bestätigen einen bestimmten View angezeigt bekommen. Dieses gelingt mir leider nicht.



    In der AppDelegate.m bei application did ReciveRemoteNotification ruft er den AlertView auf, nur leider schaffe ich es nicht das er den bestimmten View anzeigt im Storyboard.



    Folgenden Code habe ich:





    PushNotificationViewController *controller = [self.storyboardinstantiateViewControllerWithIdentifier:@"pushController"];
    [self.navigationControllerpushViewController:controller animated:YES];




    Ich hoffe mir kann einer weiterhelfen. Im Web wurde ich bisher nicht richtig fündig.
  • WO machst du das denn?

    Quellcode

    1. PushNotificationViewController *controller = [self.storyboardinstantiateViewControllerWithIdentifier:@"pushController"];
    2. [self.navigationControllerpushViewController:controller animated:YES];


    Schau dir mal die AlertView-Delegate-Methoden an ;)

    als Tipp:

    Quellcode

    1. alertView:clickedButtonAtIndex:
  • So sieht der Quellcode jetzt aus aber leider öffnet sich der View nicht.

    -(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{

    NSString *alert = [[userInfo objectForKey:@"aps"] objectForKey:@"alert"];


    NSLog(@"Nachricht!!: %@", alert);
    NSLog(@"ID: %@", alert2);

    UIApplicationState state = [[UIApplication sharedApplication] applicationState];
    if (state == UIApplicationStateActive){
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Neuer Artikel" message:alert delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Zeigen",nil];
    [alertView show];

    }
    if (state == UIApplicationStateInactive) {
    NSLog(@"Inactive")

    }


    }


    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (buttonIndex ==0){
    return;

    }


    if (buttonIndex ==1){

    UIViewController *rootViewController = self.window.rootViewController;


    UINavigationController *navigationController = rootViewController.navigationController;


    PushNotificationViewController *controller = [navigationController.storyboard instantiateViewControllerWithIdentifier:@"pushController"];

    [navigationController pushViewController:controller animated:YES];
    }
    }