如何为每周和每年的每日设置 UILocalNotifications
Posted
技术标签:
【中文标题】如何为每周和每年的每日设置 UILocalNotifications【英文标题】:How to set UILocalNotifications for daily weekly and yearly 【发布时间】:2011-08-22 09:52:52 【问题描述】:我有一个 iPhone 应用程序,我用它来每天、每周和每年触发 UILocalnotification 是否有任何好的教程可以使用此代码设置通知
- (void)alertSelector:(NSString *)AlertTitle WithFiringTime:(NSDate *)date
UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
if (!localNotification)
return;
// Set the fire date/time
[localNotification setFireDate:date];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
// Create a payload to go along with the notification
NSDictionary *data = [NSDictionary dictionaryWithObject:date forKey:@"payload"];
[localNotification setUserInfo:data];
// Setup alert notification
[localNotification setAlertBody:AlertTitle];
[localNotification setAlertAction:@"View"];
[localNotification setHasAction:YES];
[UILocalNotification setBadge];
// localNotification.soundName = UILocalNotificationDefaultSoundName;
// localNotification.soundName=@"voice.aif";
// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
谢谢
【问题讨论】:
【参考方案1】:也许this tutorial 有帮助...
【讨论】:
以上是关于如何为每周和每年的每日设置 UILocalNotifications的主要内容,如果未能解决你的问题,请参考以下文章
AppEngine cron (python) 中的每一天、每周、每月、每年
ruby [Ruby] [files,writing,frontmatter]如何为每周创建一个frontmatter文件