我有一个带有 rRule
的 iCal
文件:
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/