views:

242

answers:

2

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?

+1  A: 

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

Steam Trout
I'm actually just editing the EKEvent's alarms. I won't be creating or removing any events. Thank you though.
Programasaurus
+2  A: 

If there are two alarms that have the same absoluteDate, it seems perfectly acceptable to just remove one or the other, they are essentially duplicates.

Cory Kilger
The obvious answer. This actually occurred to me a while ago, I'm not sure why I thought otherwise. Thanks
Programasaurus