iOS - EKEvent 重复规则中的 iCal rRule

标签 ios objective-c icalendar rfc2445

我有一个带有 rRuleiCal 文件: rRule = "FREQ=WEEKLY;UNTIL=20140425T160000Z;INTERVAL=1;BYDAY=TU,TH";

我需要将此信息放入 EKEvent 中:

EKEvent *event;
event.recurrenceRules = ...

我拆分了 rRule 并将其保存在 NSArray 中:

 NSArray * rules = [evento.rRule componentsSeparatedByString:@";"];
 event.recurrenceRules = rules;

但是出现错误:

-[__NSCFString relationForKey:]: unrecognized selector sent to instance 0x21283350
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString relationForKey:]: unrecognized selector sent to instance 0x21283350'

你能帮帮我吗? 感谢您的提前。

最佳答案

我找到了使用 EKRecurrenceRule+RRULE 库的解决方案,它非常易于使用。

链接:https://github.com/jochenschoellig/RRULE-to-EKRecurrenceRule

使用示例:

NSString *rfc2445String = @"FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2"; // The 2nd to last weekday of the month

// Result
EKRecurrenceRule *recurrenceRule = [[EKRecurrenceRule alloc] initWithString:rfc2445String];
NSLog(@"%@", recurrenceRule);

关于iOS - EKEvent 重复规则中的 iCal rRule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21777014/

相关文章:

ios原生音频加速不跳过

ios - -[AVMvidFrameDecoder advanceToFrame :] 'framebuffer num bytes' 中的 AVAnimator 断言失败

iphone - iOS 中的多个对象管理器

ios - indexPath.row 给出了奇怪的值

iphone - 检测 UITableView SECTION 上的触摸?

c# - 如何使用 DDay.iCal 创建 Outlook "appointment"?

ios - 无法转换类型的值 - 自定义点注释

iphone - 具有固定大小自定义图像的 UIButton

icalendar - 在 iCal 文件中编码换行符

php - iOS 上的 iCalendar .ics 接受/拒绝