0

我希望我的应用程序在后台运行时检查日期。那时,我想做一个本地通知,但我知道该怎么做......我感兴趣的是,如果有人甚至点击主页按钮,我的应用程序在后台,我想要我的应用程序检查它是什么日期(一天一次,在后台),如果它是一个特定的日期,我想做一个本地通知 - 一种特定于应用程序的日历......

有任何想法吗??

4

2 回答 2

1

您的应用程序(可能)不会在后台运行,因此您无法检查日期,但您可以fireDate使用以下命令为特定日期()安排本地通知

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = [NSDate dateWithTimeIntervalSinceNow:60*90];  // the date you want the notification to fire.
localNotif.timeZone = [NSTimeZone defaultTimeZone];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];

有关更多信息,请参阅Apple 的文档

于 2012-08-07T20:42:12.910 回答
1

也许这篇文章对你有帮助http://mobileorchard.com/ios-advanced-programming-understanding-ios-4-multitasking/。祝你好运!

于 2012-08-07T21:15:36.183 回答