简体   繁体   English

如何在 iOS 中分配提醒(EKReminder)?

[英]How to get assignment of a reminder (EKReminder) in iOS?

[Update: I submitted an official Apple Developer feedback request for an update to the EventKit API and documentation] [更新:我提交了 Apple 开发者官方反馈请求,要求更新 EventKit API 和文档]

[Update: I contacted Apple Support and they said to read the docs...so I think Matt is correct, It is simply not available.] [更新:我联系了 Apple 支持,他们说要阅读文档……所以我认为 Matt 是正确的,它根本不可用。]

According to Apple Docs , the EKReminder is a subclass of EKCalendarItem.根据Apple Docs ,EKReminder 是 EKCalendarItem 的子类。 It has the following (lot) of properties:它具有以下(很多)属性:

As a reminder:提醒一句:

  • priority: Int - The reminder's priority. priority: Int - 提醒的优先级。
  • startDateComponents: DateComponents?开始日期组件:日期组件? - The start date of the task. - 任务的开始日期。
  • dueDateComponents: DateComponents? dueDateComponents:日期组件? - The date by which the reminder should be completed. - 应完成提醒的日期。
  • isCompleted: Bool - A Boolean value determining whether or not the reminder is marked completed. isCompleted: Bool - 确定提醒是否标记为已完成的 Boolean 值。
  • completionDate: Date?完成日期:日期? The date on which the reminder was completed.提醒完成的日期。

As a calendar item:作为日历项目:

  • title: String.标题:字符串。 -The title for the calendar item. - 日历项目的标题。
  • location: String?位置:字符串? - The location associated with the calendar item. - 与日历项目关联的位置。
  • creationDate: Date?创建日期:日期? - The date that this calendar item was created. - 创建此日历项目的日期。
  • lastModifiedDate: Date? lastModifiedDate:日期? - The date that the calendar item was last modified. - 上次修改日历项目的日期。
  • timeZone: TimeZone?时区:时区? - The time zone for the calendar item. - 日历项目的时区。
  • url: URL? url:URL?
  • hasNotes: Bool - A Boolean value that indicates whether the calendar item has notes. hasNotes: Bool - 一个 Boolean 值,指示日历项是否有注释。
  • notes: String?笔记:字符串? - The notes associated with the calendar item. - 与日历项目关联的注释。
  • hasAttendees: Bool - A Boolean value that indicates whether the calendar item has attendees. hasAttendees: Bool - 一个 Boolean 值,指示日历项目是否有与会者。
  • attendees: [EKParticipant]?与会者:[EKParticipant]? -The attendees associated with the calendar item, as an array of EKParticipant objects. - 与日历项目关联的与会者,作为 EKParticipant 对象的数组。

I can print any one of these items from reminders in my app.我可以从我的应用程序的提醒中打印这些项目中的任何一项。

However, if I create a reminder that is "assigned to a person", I cannot get that information.但是,如果我创建一个“分配给某人”的提醒,我将无法获得该信息。 I know it must be stored somewhere.我知道它必须存放在某个地方。

If you "print" a reminder, you get something like this:如果你“打印”一个提醒,你会得到这样的东西:

EKReminder <0x0000000> {title = Do the thing; dueDate = 2021-02-25 08:00:00 +0000; completionDate = (null); priority = 0; calendarItemIdentifier = XXXXX-XXXX-XXXX-XXXX-XXXXXX; alarms = (null)}

If you want, you can "print" any of the other items, like print(reminder.notes!) .如果需要,您可以“打印”任何其他项目,例如print(reminder.notes!)

I thought shared items and assignments might use the attendees property, but it is nil - even when the reminder has an assigned person.我认为共享项目和作业可能会使用attendees属性,但它是 nil - 即使提醒有指定的人。

How can you get to the assigned person?你怎么能找到指定的人?

提醒应用程序详细信息示例,其中分配人员

This is probably a feature of upgraded reminders.这可能是升级提醒的一个功能。 But the API was never upgraded to match, so there's no programmatic access to it.但是 API 从未升级为匹配,因此无法以编程方式访问它。

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

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