iOS-NSLocalNotification-每隔一天设置一次通知

iOS-NSLocalNotification-每隔一天设置一次通知,ios,uilocalnotification,Ios,Uilocalnotification,我想每隔一天在NSDayCalendarUnit上设置一个本地通知,如何实现这一点 到目前为止,我已经做到了: - (void)scheduleLocalNotication { UILocalNotification *localNotification = [[UILocalNotification alloc] init]; // Set the fire date/time [localNotification setFireDate:[NSDate dateWithTimeInte

我想每隔一天在NSDayCalendarUnit上设置一个本地通知,如何实现这一点

到目前为止,我已经做到了:

- (void)scheduleLocalNotication {

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

// Set the fire date/time
[localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:1]];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];

localNotification.applicationIconBadgeNumber = 1;

// Setup alert notification
[localNotification setAlertAction:@"Open App"];
[localNotification setAlertBody:@"setAreltBody"];
[localNotification setAlertBody:@"You had set a Local Notification on this time"];

localNotification.soundName = UILocalNotificationDefaultSoundName;
[localNotification setHasAction:YES];

localNotification.repeatInterval = NSDayCalendarUnit;

UIApplication *app = [UIApplication sharedApplication];
[app scheduleLocalNotification:localNotification];
}

我可以更改这一行吗:

localNotification.repeatInterval=NSDayCalendarUnit

对这样的事情:

localNotification.repeatInterval=NSDayCalendarUnit*2

我想不会,因为NSDayCalendarUnit是一个typedef,所以我如何才能做到这一点


提前10倍

我认为使用UILocalNotification的repeatInterval属性是不可能的,原因与您已经指出的相同,NSCalendarUnit是一个枚举,因此您只能使用以下值:


另一种选择是在循环中安排多个通知,并始终在前一个火灾日期的基础上增加24小时。

您的意思是希望每隔一天设置一次,对吗?