简体   繁体   中英

How to identify an EKAlarm in an EKEvent

I'm developing an app that will require setting and removing alarms accordingly. I'm wondering if I set an alarm for an EKEvent, how can I identify it when I want to remove it?

The only accessible properties of the EKAlarm are absoluteDate and relativeOffset. I feel like it would cause problems if the alarm I set has the same relativeOffset or absoluteDate as a different user generated alarm.

Any suggestions?

如果有两个警报具有相同的absoluteDate,则删除一个或另一个警报似乎是完全可以接受的,它们本质上是重复的。

Just an idea but you may want to serialize your event and save it to some persistent storage and then, when you need to remove it, deserialize it and remove that exact event. This assumes that you want to add and remove events between multiple application launches and that the user does not modify your event by hand (dunno if it's even possible but still). Also from what I see in the documentation EKEvent has much more properties than just two you listed.

EKEvent Class Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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