繁体   English   中英

带有 RecurrenceRules 的 EKReminder

[英]EKReminder with RecurrenceRules

我正在获取提醒,获取标题、上次修改日期、注释等没有问题,但我唯一的问题是recurrenceRules。 这是我的代码:

print(get_reminder_detail.recurrenceRules)

当我运行该应用程序时,它说:

[EKRecurrenceRule <0x28051c1e0> RRULE FREQ=WEEKLY;INTERVAL=1;UNTIL=20200815T061923Z]

当我看到两件事时,我不确定如何从中提取信息……首先,如何将 FREQ 和 INTERVAL 带入字符串? 其次,如何将 UNTIL 拉入 DateComponents?

不要查看用于在控制台中打印出重复规则的字符串。 查看重复规则本身的属性。

https://developer.apple.com/documentation/eventkit/ekrecurrencerule

你需要的一切都在那里。

我才意识到,我找到了解决办法。 这里的代码:

if let getrecurrence = get_reminder_detail.recurrenceRules?.first {
   if getrecurrence.frequency == .daily {print("Daily!")}
   if getrecurrence.frequency == .monthly {print("Monthly!")}
   if getrecurrence.frequency == .weekly {print("Weekly!")}
   if getrecurrence.frequency == .yearly {print("Yearly!")}
}

我想我问得太早了

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM