2016-12-26 1 views

Répondre

0

Si vous souhaitez appeler une notification avec un intervalle de temporisation spécifique ou un appel après le premier, la notification locale a la propriété repeatInterval et la valeur doit être NSCalendarUnit. Et répétez avec une minuterie spécifique.

Sinon, deuxième option est inférieure à la méthode de délégué toujours appeler

-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{ 
    // I recieved a notification 
} 

Lorsque votre notification get dans le bloc

vous pouvez supprimer toutes les notifications locales et en créer un nouveau avec la date de l'incendie doivent être

localNotification.fireDate = [NSDate date]; 
0

Essayez de vérifier,

[[UIApplicatio n sharedApplication] scheduledLocalNotifications]

Ceci retournera un tableau de notifications planifiées.

Vous pouvez vérifier le nombre de tableaux ou de tableaux NSLog et obtenir des détails si la notification locale est annulée ou non.

+0

La notification était déjà affichée. scheduledLocalNotifications renvoie les notifications dans la liste d'attente. Ce n'est pas mon cas. –

2

Vous pouvez attendre un peu après avoir appelé UILocalNotification cancelLocalNotification: et vous inscrire à nouveau pour la nouvelle UILocalNotification

Quelque chose comme ça

[[UIApplication sharedApplication] cancelLocalNotification:someNotification]; 
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ 
/* register UILocalNotification again here after delay */ 

});