我想每天两次触发本地通知,例如:- 每天早上 7 点和晚上 6 点,所以任何人都可以帮助我,我该怎么做?
无法设置触发本地通知的自定义时间已经到处查看,但如果有任何帮助将不胜感激,但对于一天两次触发本地通知没有任何帮助
提前致谢 :)
这是我使用本地通知的代码的和平,但它根本没有触发:(
- (void)scheduleNotification
{
[[UIApplication sharedApplication] cancelAllLocalNotifications];
Class cls = NSClassFromString(@"UILocalNotification");
if (cls != nil) {
NSString *end = @"2013-09-20 11:24:00 +0000";
NSDate *endDate = [self convertStringToDate:end];
NSLog(@"end date :%@", endDate);
UILocalNotification *notif = [[cls alloc] init];
notif.fireDate = endDate;
notif.timeZone = [NSTimeZone defaultTimeZone];
notif.alertBody = @"Did you forget something?";
notif.alertAction = @"Show me";
notif.soundName = UILocalNotificationDefaultSoundName;
notif.applicationIconBadgeNumber = 1;
notif.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
[notif release];
}
}