繁体   English   中英

Swift 卡在发生日期和生日联系人标识符中

[英]Swift stuck with occurrenceDate and birthdayContactIdentifier

我在 EKEvent 方面取得了成功,包括日历标识符、标题、开始/结束时间等……但我只剩下两个是occurrenceDate 和birthdayContactIdentifier。 这是我卡住的代码:

if let getbirthday = get_event.birthdayContactIdentifier {
   print(getbirthday.description)
}

这将显示联系人标识符,它可以正常工作,但我如何链接到带有标识符的联系人?

if let getoccurrence = get_event.occurrenceDate {
   print(getoccurrence.description)
}

结果显示:

2020-05-30 02:00:00 +0000
2020-05-29 06:00:00 +0000

我不知道为什么它显示 5 月 30 日凌晨 2 点和 5 月 29 日早上 6 点,因为我把晚上 8 点到晚上 10 点 30 分,每周重复一次。 如何让我的应用知道重复的频率和时间?

感谢帮助!

我发现了这个问题。 我使用代码:

if let getrecurrence = get_event.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