4

我能够访问 EKEventStore 的所有功能,例如保存任何事件或从日历中删除任何事件。

但是如何为该事件创建贪睡让说所有 saveEvent 我需要 15 分钟贪睡?

我没有发现这样的方法

有人知道这种方法吗?

4

2 回答 2

0

如果你试图在你的应用程序中设置一些功能在十五秒延迟后执行,你可以使用这样的东西:

[self performSelector:@selector(yourMethod) withObject:nil afterDelay:15];

EventKit 旨在为用户设置本地通知,无论用户是否正在运行您的应用程序,都可以显示这些通知。它们与推送通知完全相同,只是它们本地存储在用户设备上并且不需要网络连接。

如果您尝试向 EventKit 通知添加贪睡功能,您可以使用 ApplicationDidLoadWithOptions 方法在您的应用程序中实现它。每当用户单击本地通知上的“确定”按钮时,都会调用该方法。据我所知,EventKit 框架本身没有内置的贪睡功能。

于 2011-05-18T17:35:43.883 回答
-1

我从来没有试过那个图书馆,但你试过NSTimer吗?就像是:

NSTimer *snoozeTimer;   
//make it reachable in whole class

//setting the snooze timer. 900 s = 15 min. change to "repeats:NO" if you want just one snooze.   

snoozeTimer = [NSTimer scheduledTimerWithTimeInterval:900.0 target:self selector:@selector(someAlarmMethod) userInfo:nil repeats:YES];

//and after finished snooze  
[snoozeTimer invalidate];

也许这不是你要找的,但它可能有用:)

于 2011-04-25T21:52:43.240 回答