Comment triggersr une notification locale toutes les deux semaines?
Ce que j'ai fait était:
UILocalNotification *localNotification = UILocalNotification.new; localNotification.repeatInterval = 14; localNotification.fireDate = [NSDate dateWithTimeInterval:10 sinceDate:notificationDate]; localNotification.alertBody = notificationMessage; localNotification.alertAction = @"Open"; localNotification.category = @"default_category"; [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
Essayez le code ci-dessous:
UILocalNotification *notification = [[UILocalNotification alloc]init]; notification.userInfo = @{@"notification_identifier":@"After14Days"}; notification.fireDate = [[NSDate date] dateByAddingTimeInterval:(60*60*24*14)]; notification.alertBody = @"Text to display"; notification.repeatInterval = NSCalendarUnitDay; [[UIApplication sharedApplication] scheduleLocalNotification:notification];
Définissez repeatInterval de UILocalNotification sur NSCalendarUnitDay.