简体   繁体   English

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

[英]Swift stuck with occurrenceDate and birthdayContactIdentifier

I've success with EKEvent include calendar identifier, title, start/end time, etc...but only two left I am stuck with is occurrenceDate and birthdayContactIdentifier.我在 EKEvent 方面取得了成功,包括日历标识符、标题、开始/结束时间等……但我只剩下两个是occurrenceDate 和birthdayContactIdentifier。 Here my code where I am stuck:这是我卡住的代码:

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

This will show contact identifier, which work fine but how can I link to contact with identifier?这将显示联系人标识符,它可以正常工作,但我如何链接到带有标识符的联系人?

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

The result show:结果显示:

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

I am not sure why it show May 30 at 2am and May 29 at 6am because I put 8pm to 10:30pm, repeating every weekly.我不知道为什么它显示 5 月 30 日凌晨 2 点和 5 月 29 日早上 6 点,因为我把晚上 8 点到晚上 10 点 30 分,每周重复一次。 How can I get my app know how often repeating and what time?如何让我的应用知道重复的频率和时间?

Thanks for help!感谢帮助!

I found the issue.我发现了这个问题。 I use the code:我使用代码:

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