是否可以将 UILocalNotification 对象保存到 plist 或 sqlite 数据库或其他位置(例如 NSUserDefaults)?
我想保存 UILocalNotifications 的对象,如下所示,最好是在我可以检索它的地方,并且能够保存多个 UILocalNotification 对象
UILocalNotification *local=[[UILocalNotification alloc]init];
[local setAlertBody:str];
[local setFireDate:dat];
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"some_id_to_cancel" forKey:@"ID"];
local.userInfo = infoDict;
//local.hasAction=NO;
//[[UIApplication sharedApplication] presentLocalNotificationNow:local];
[[UIApplication sharedApplication] scheduleLocalNotification:local];
[local release];
现在我想将本地对象保存在某个地方,例如 plist 或任何我可以检索它们的存储。
I want to save the objects of UILocalNotifications such as following, preferably somewhere from where I can retrieve it and could be able to save multiple UILocalNotification objects
UILocalNotification *local=[[UILocalNotification alloc]init];
[local setAlertBody:str];
[local setFireDate:dat];
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"some_id_to_cancel" forKey:@"ID"];
local.userInfo = infoDict;
//local.hasAction=NO;
//[[UIApplication sharedApplication] presentLocalNotificationNow:local];
[[UIApplication sharedApplication] scheduleLocalNotification:local];
[local release];
Now I want to save local object somewhere such as plist or any storages from where I could get retrieve them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的东西:
Something like this:
既然
UILocalNotification
符合NSCoding
协议,那么,是的。来自文档
Since
UILocalNotification
conforms to theNSCoding
protocol, then, yes.From the documentation