管理您的应用已安排的本地通知的好方法是什么?

Bea*_*red 5 iphone cocoa-touch ipad ios localnotification

我正在深入研究iOS开发,并且一直在研究闹钟应用程序以熟悉iOS平台和SDK.我正在使用本地通知处理我的警报,但我需要一些管理我设置的本地通知的方法,以便在我编辑或删除与它们相关的任何警报时可以更新它们.我想出了如何在计划cancelLocalNotification:后使用函数取消计划本地通知,但我很难弄清楚如何检索与编辑或删除的警报关联的本地通知对象,以便我可以使用该功能.我应该注意,用于创建本地通知的所有警报对象都存储在Core Data DB中,其界面定义为......

@interface Alarm :  NSManagedObject  
{
}

@property (nonatomic, retain) NSNumber * Snooze;
@property (nonatomic, retain) NSNumber * AlarmID;
@property (nonatomic, retain) NSString * Label;
@property (nonatomic, retain) NSDate * Repeat;
@property (nonatomic, retain) NSDate * Time;
@property (nonatomic, retain) NSNumber * Enabled;
@property (nonatomic, retain) NSString * Song;
@property (nonatomic, retain) NSString * Sound;

@end
Run Code Online (Sandbox Code Playgroud)
  1. 管理我的应用程序计划的本地通知的好方法是什么,以便我以后可以检索那些本地通知对象并在需要时重新安排它们?
  2. 有没有办法检索您的应用程序已安排的本地通知?
  3. 如果是这样,有没有办法独特地识别它们?

非常感谢您的帮助!

sha*_*sha 16

要回答问题#2的使用scheduledLocalNotifications,这将回复您为您的应用安排的所有通知的NSArray.

回答问题#3使用类的userInfo属性UILocalNotification.这是一本字典,你可以保存你想要的任何东西.