开发者

calculating recurring events in ObjC (iPhone)

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开发者_Go百科 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"...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜