Voici mon code de notification locale, je reçois notification tous les jours en utilisant [localNotification setRepeatInterval:NSCalendarUnitDay];
maintenant je veux arrêter ou annuler les notifications après la date et l'heure expire en utilisant la date et l'heure de fin. et où dois-je mettre en œuvre sur ceux-ci, N'importe qui s'il vous plaît expliquer.Advance en remerciements.Définir un rappel en utilisant la notification locale dans iOS Objectif C
NSString *startdate = @"10-12-2016 07:00 am";
NSString *enddate = @"14-12-2016 07:00 am";
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = startdate;
localNotification.alertBody = [NSString stringWithFormat:@"%@ ",self.nameTextField.text];
localNotification.soundName = @"bell_tree.mp3";
localNotification.alertAction = @"Show me the item";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
[localNotification setRepeatInterval:NSCalendarUnitDay];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
et ceci est mon délégué app codages didReceiveLocalNotification,
- (void)application:(UIApplication *)application didReceiveLocalNotification:(nonnull UILocalNotification *)notification {
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Reminder"
message:notification.alertBody
delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
// Request to reload table view data
[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadData" object:self];
// Set icon badge number to zero
application.applicationIconBadgeNumber = 0;
}
Comment puis-je vérifier la réception de la date et l'heure de notification est égale à la chaîne de date et heure de fin. alors seulement son droit possible ?, pouvez-vous expliquer s'il vous plaît. – Jaikannan