计算 ObjC (iPhone) 中的重复事件

发布于 2024-11-18 05:01:51 字数 566 浏览 5 评论 0原文

我正在寻找一个库,可以让我处理 iPhone 上 ObjC 中的重复事件。我正在编写一个任务管理应用程序,需要处理计划的(每月/每周/等)任务,并且我需要检查哪些任务应该在给定的一天发生。基本上,我需要类似 runtice_cube,但是在 ObjC 中。

我查看了Apple的EventKit框架,它似乎提供了我需要的功能,但问题是它只适用于日历应用程序中用户自己的日历。我需要一些东西可以让我处理仅存储在应用程序内部的内部数据。我看不到任何在 EventKit 中创建内部应用内日历的方法,并且我不想弄乱用户的主日历。

还有 ObjC 的 Google 数据库,它也做了类似的事情,但据我所知,它不会在客户端进行任何此类计算,您设置的重复规则仅用于将它们传递到服务器作为 URL 参数,我需要能够离线使用它。

有谁知道这样的库是否存在?我可以自己编写代码,但我担心这可能是,正如有人在这里所说的那样,“拥抱疯狂”......

I'm looking for a library that would let me handle recurring events in ObjC on iPhone. I'm writing a task management app that needs to handle scheduled (monthly/weekly/etc.) tasks, and I need to check which tasks should have an occurrence on a given day. Basically, I need something like runt or ice_cube, but in ObjC.

I looked at Apple's EventKit framework, which seems to provide the functionality I need, but the problem is that it only works with user's own calendars in the Calendar app. I need something that would let me work on internal data stored only inside the application. I don't see any way to create an internal in-app calendar in EventKit, and I don't want to mess with user's main calendar.

There's also the Google Data library for ObjC, which also does something similar, but as far as I can tell, it doesn't do any such calculations on the client side, the recurrence rules you set are only used for passing them to the server as URL parameters, and I need to be able to use it offline.

Does anyone know if such lib exists? I could code it myself, but I'm afraid that this might be, as someone said here on SO, "embracing insanity"...

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

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

发布评论

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

评论(1

家住魔仙堡 2024-11-25 05:01:51

我假设您不会问这个问题,除非 NSDate 和 NSCalendar 提供的功能不足以满足您的需求,但如果您没有从那里开始,请转到 阅读它们,然后再投入更复杂的事情。

在您完成了 NSDate 和 NSCalendar 提供的内容之后,一个好的起点可能是 libicu(Unicode 国际组件)。更具体地说,此页面看起来可能提供了丰富的信息。 libicu 相当成熟,本质上是当今 Unicode 处理的参考实现。它相当复杂,但我非常有信心它可以处理这类事情。

我在这里可以给你的最好建议是不要自己动手。日期和时间处理是一个复杂的主题;有很多微妙之处。有些人一生都在思考这些陷阱、微妙之处和变幻莫测。不要试图重新发明这个轮子而成为其中的一员。

I'm assuming you wouldn't have asked this unless the functionality provided by NSDate and NSCalendar were inadequate for your needs, but if you didn't start there, go read about them, before you take the plunge into something more complicated.

After you've gone past the end of what NSDate and NSCalendar provide, a good place to start might be with libicu (International Components for Unicode). More specifically, this page looks like it might be informative. libicu is quite mature and is essentially the reference implementation for Unicode handling these days. It's quite complex, but I feel pretty confident that it can handle this sort of thing.

The best advice I can give you here is to not roll your own. Date and time handling is a complex topic; there are many subtleties. There are folks who spend their entire careers thinking about these pitfalls, subtlties and vagaries. Don't become one of them by trying to reinvent this wheel.

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