简体   繁体   English

带有 RecurrenceRules 的 EKReminder

[英]EKReminder with RecurrenceRules

I was work on fetching reminder, I have no problem fetching title, last modified date, notes, etc but I only have problem is recurrenceRules.我正在获取提醒,获取标题、上次修改日期、注释等没有问题,但我唯一的问题是recurrenceRules。 Here my code:这是我的代码:

print(get_reminder_detail.recurrenceRules)

And when I ran the app, it said:当我运行该应用程序时,它说:

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

As I see two things I am not sure how to pull information from this...first, how can I take FREQ and INTERVAL into the string?当我看到两件事时,我不确定如何从中提取信息……首先,如何将 FREQ 和 INTERVAL 带入字符串? Second, how can I pull the UNTIL into the DateComponents?其次,如何将 UNTIL 拉入 DateComponents?

Do not look at the string that is used to print out the recurrence rule in the console.不要查看用于在控制台中打印出重复规则的字符串。 Look at the properties of the recurrence rule itself.查看重复规则本身的属性。

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

Everything you need is right there.你需要的一切都在那里。

I just realized it, I found the resolved.我才意识到,我找到了解决办法。 Here the codes:这里的代码:

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!")}
}

I guess I ask question too early我想我问得太早了

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

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