我正在构建一个提醒应用程序,我真的很感兴趣如何设置一个提醒,让它每天/每个月/每小时重复一次。
基本上,我想设置一些重复的东西,即使我的应用程序没有运行。在我的例子中,一个本地通知触发。
谢谢!
发布于 2013-02-20 22:29:31
您可以使用NSCalendarUnits轻松设置重复间隔
notification.repeatInterval= NSDayCalendarUnit;有关更多日历单位,请查看http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/Reference/NSCalendar.html#//apple_ref/doc/c_ref/NSCalendarUnit上的常量
发布于 2013-02-20 22:25:55
你必须使用本地推送通知,因为当你的应用程序在后台运行时,这是苹果允许你做一些事情的唯一方式:
查看以下内容以了解更多信息:http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008194-CH1-SW1
这是关于它的一个很好的教程:http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
发布于 2013-02-20 22:26:52
查看有关使用UILocalNotifications的苹果参考文档here。我相信这就是你要找的。
您可以利用UILocalNotifications在您喜欢的任何时间或日期显示本地通知。
David Linsin在这个here上也有一个很好的帖子。
祝好运!
https://stackoverflow.com/questions/14982142
复制相似问题