如何每两周触发一次本地通知?
我所做的是:
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];
最佳答案
试试下面的代码:
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];
关于ios - 如何每两周设置一次本地通知,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38870576/