简体   繁体   English

使用唯一标识符创建 EKEvent(不可编辑)

[英]Creating EKEvent with Unique Identifier(Not Editable)

I want to create an EKEvent to add it in device calendar.我想创建一个 EKEvent 以将其添加到设备日历中。 Is there any way to set a unique id (which a user can not edit in Calendar app) to this event so that I can identify or match it with my event.有什么方法可以为此事件设置唯一 ID(用户无法在日历应用程序中编辑),以便我可以识别它或将其与我的事件匹配。

I am creating event like this我正在创建这样的事件

let event = EKEvent.init(eventStore: eventStore)
event.title = "My location"
event.location = "Location Address"

// Setting Start - End Date
event.startDate = Date()
event.endDate = Date()

do {
    // Saving Events
    try eventStore.save(event, span: .thisEvent, commit: true)
    let message = "Schedule has been added to your device's calendar."
    showAlert(title: kFVApplicationTitle, message: message)
} catch {
    let message = "Schedule could not be added to your device's calendar."
    showAlert(title: kFVApplicationTitle, message: message)
}

为 EKEvent 创建一个类别并在其中添加其他属性解决了我的问题。

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

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