【问题标题】:EKReminder with RecurrenceRules带有 RecurrenceRules 的 EKReminder
【发布时间】:2020-06-01 04:30:10
【问题描述】:

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

print(get_reminder_detail.recurrenceRules)

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

[EKRecurrenceRule RRULE FREQ=WEEKLY;INTERVAL=1;UNTIL=20200815T061923Z]

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

【问题讨论】:

    标签: ios swift ekevent ekeventstore ekreminder


    【解决方案1】:

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

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

    您需要的一切都在那里。

    【讨论】:

      【解决方案2】:

      我刚刚意识到,我找到了解决办法。代码如下:

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

      我想我问得太早了

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多