簡體   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