Search code examples
ioscalendareventkit

iOS: EKEventStoreChangedNotification. When is it sent?


I've got an app that shows calendar events. I want it to update whenever there's a change to the user's calendar in iCloud.

The docs claim EKEventStoreChangedNotification is sent when an event is added/removed/modified. And I have sometimes found that to be the case. But other times, no notification is sent at all. Every three minutes I call [EKEventStore refreshSourcesIfNecessary], but even that won't pick up the change. The only way I can reliably get a change detected in my app is by switching to the Calendar app, waiting for the event change to appear there (normally within a few seconds), then going back to my app…and there it is.

One more thing: I have "Push" notifications turned on my for my iCloud calendars.

Any idea what is going on here? Why is it inconsistent? And how can I make it consistent?

Thanks!


Solution

  • Not sure it helps, but I also hit this issue (just assuming I could rely on the EKEventStoreChangedNotification)... With the approach that you took (calling [EKEventStore refreshSourcesIfNecessary] tho, I do get consistent results, where moments after calling that method, I then receive the notification of changes. Seems to work all the time.