たとえば、毎日午前 7 時と午後 6 時のようにローカル通知を毎日 2 回起動したいので、どうすればそれを行うことができるか教えてください。
ローカル通知を起動するカスタム時間を設定することはできませんが、ローカル通知を 1 日に 2 回起動するのに役立つものは何もありませんでした。
前もって感謝します :)
これは私がローカル通知を使用しているコードの平和ですが、まったく起動していません:(
- (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];
}
}