IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Objective-C Discussion :

changement de vue dans didReceiveRemoteNotification


Sujet :

Objective-C

  1. #1
    Membre habitué
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juillet 2011
    Messages
    135
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : Conseil

    Informations forums :
    Inscription : Juillet 2011
    Messages : 135
    Points : 153
    Points
    153
    Par défaut changement de vue dans didReceiveRemoteNotification
    Bonjour tout le monde,
    Je débute avec le développement d'Ios.
    Voila j'aimerai changer de vue lorsque je reçoit une notification (PUSH). J'ai bien la fonction didReceiveRemoteNotification qui permet de réaliser des actions lorsque l'application reçoit un push.

    Est ce que vous pouvez me donner la démarche a suivre?
    Voila mon code mais ca ne marche pas.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
     
    #if !TARGET_IPHONE_SIMULATOR
     
        NSLog(@"remote notification: %@",[userInfo description]);
     
        NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];
     
        NSString *alert = [apsInfo objectForKey:@"alert"];
     
        NSLog(@"Received Push Alert: %@", alert);
     
        NSString *sound = [apsInfo objectForKey:@"sound"];
     
        NSLog(@"Received Push Sound: %@", sound);
     
        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
     
        NSString *badge = [apsInfo objectForKey:@"badge"];
     
        NSLog(@"Received Push Badge: %@", badge);
     
        application.applicationIconBadgeNumber = [[apsInfo objectForKey:@"badge"] integerValue];
     
     
     
        //Transition Custom
        [CATransaction begin];
     
        CATransition *transition = [CATransition animation];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromRight;
        transition.duration =  0.3f ;
        transition.fillMode = kCAFillModeForwards;
        transition.removedOnCompletion = YES;
     
        [[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"];
        [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
        [CATransaction setCompletionBlock: ^ {
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ {
                [[UIApplication sharedApplication] endIgnoringInteractionEvents];
            });
        }];
     
        self.detailAlertRecuesView = [[[detailAlertRecuesViewController alloc] initWithNibName:@"detailAlertRecuesViewController" bundle:nil] autorelease];
     
        [self.window.rootViewController presentModalViewController:self.detailAlertRecuesView animated:YES];
        //[self.window.rootViewController dismissModalViewControllerAnimated:YES];
     
        [self.window makeKeyAndVisible];
        /*
        self.loadingViewController = [[[LoadingViewController alloc] initWithAlert:@"LoadingViewController" bundle:nil alertid:1807] autorelease];
        self.win  = self.loadingViewController;
        [self.window makeKeyAndVisible];*/
     
        [CATransaction commit];
    #endif
    }
    Erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Warning: Attempt to present <detailAlertRecuesViewController: 0x1f5a52b0> on <LoadingViewController: 0x1f58cbf0> whose view is not in the window hierarchy!

  2. #2
    Membre du Club
    Femme Profil pro
    beler.fr
    Inscrit en
    Mars 2014
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Belgique

    Informations professionnelles :
    Activité : beler.fr
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2014
    Messages : 25
    Points : 43
    Points
    43
    Par défaut solution
    Bonjour,

    Tu peux essayer avec:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
     
        // Push controller
        MessagePushViewController * msgController = [[MessagePushViewController alloc]init];
        [navController.visibleViewController presentViewController:msgController animated:YES completion:nil];
    Bonne journée,
    Mihaela

Discussions similaires

  1. [RCP] Bouton radio + changement des composites dans la même vue
    Par chiraz86 dans le forum Eclipse Platform
    Réponses: 6
    Dernier message: 16/03/2010, 15h41
  2. Changement de vue dans une perspective.
    Par tatemilio2 dans le forum Eclipse Platform
    Réponses: 9
    Dernier message: 24/11/2007, 16h12
  3. Oracle Designer: récupération d'une vue dans la base
    Par BILLYPATOU dans le forum Designer
    Réponses: 2
    Dernier message: 19/03/2004, 11h08
  4. [DEBUTANT] Une vue dans une procedure stockee ?
    Par Invité dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 25/02/2004, 11h57
  5. Changements de colonnes dans une BDD MySQL
    Par arnaud_verlaine dans le forum Requêtes
    Réponses: 8
    Dernier message: 07/08/2003, 11h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo