Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a result of exactly how the notifications are dispatched and what each is actually notifying about. In my experience, you can expect to receive at least one notification for a change to an item (event, reminder, etc.) and at least one more for the resultant change to the containing calendar for that item.</p> <p>Without seeing your code and knowing what changes are being made, I can't be too specific about an answer; however, in general, you have two options.</p> <ol> <li>Observe the changes more closely - maybe you can safely ignore some notifications if they concern events that don't pertain to your app, or if you've already handled a change for a particular item.</li> <li>Coalesce multiple changes into a single batch of handler code. Basically, when you receive the notification, instead of kicking off your response right away, start a timer that will run the response in a second or two. Then, if another notification comes in before the timer fires, you can cancel the timer and reset it. This way, you can batch up multiple notifications that come in a short time window and only respond to them once (when the timer eventually fires).</li> </ol> <p>The latter solution is my preferred answer, and might look something like (temporarily ignoring threading concerns):</p> <pre><code>@property (strong) NSTimer *handlerTimer; - (void)handleNotification:(NSNotification *)note { // This is the function that gets called on EKEventStoreChangedNotifications [self.handlerTimer invalidate]; self.handlerTimer = [NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(respond) userInfo:nil repeats:NO]; [[NSRunLoop mainRunLoop] addTimer:self.handlerTimer forMode:NSDefaultRunLoopMode]; } - (void)respond { [self.handlerTimer invalidate]; NSLog(@"Here's where you actually respond to the event changes"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload