Précédent   Forum du club des développeurs et IT Pro > Systèmes > Mac > Objective-C
Objective-C Forum d'entraide sur le langage de programmation Objective-C
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 15/11/2012, 14h36   #1
rafleboss
Membre habitué
 
Homme
Développeur Web
Inscription : juillet 2011
Messages : 115
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

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

Informations forums :
Inscription : juillet 2011
Messages : 115
Points : 114
Points : 114
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 :
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 :
1
2
Warning: Attempt to present <detailAlertRecuesViewController: 0x1f5a52b0> on <LoadingViewController: 0x1f58cbf0> whose view is not in the window hierarchy!
rafleboss est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 12h05.


 
 
 
 
Partenaires

Hébergement Web