EventKit 框架中的 Snooze 方法?

发布于 2024-10-21 16:02:50 字数 143 浏览 1 评论 0原文

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

但是如何为该事件创建暂停,比如说我为所有 saveEvent 需要 15 分钟的暂停?

我没有找到这样的方法

有人知道这样的方法吗?

I am able to access all functionality of EKEventStore like save any event or remove any event from Calendar.

But how can create snooze for that event lets say 15 min snooze i needed for all saveEvent ?

I didn't find out as such method

Anyone know such method ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

↘人皮目录ツ 2024-10-28 16:02:50

如果您尝试将应用程序中的某些功能设置为在十五秒延迟后执行,您可以使用如下内容:

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

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

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

If you are trying to set some function in your application to be performed after a fifteen second delay, you could use something like this:

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

EventKit is intended to set local notifications for the user that can be shown whether the user is running your application or not. They are exactly like push notifications, except they are stored locally on the user's device and don't require a network connection.

If you are are trying to add a snooze function to an EventKit notification, you could implement it in your application using the ApplicationDidLoadWithOptions method. That method is called whenever the user clicks the "OK" button on your local notification. As far as I know, there is no built in snooze functionality in the EventKit framework itself.

情愿 2024-10-28 16:02:50

我从未尝试过该库,但你尝试过 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];

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

I've never tried that library, but have you tried NSTimer? Something like:

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];

Maybe it's not what you're looking for, but it might work :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文