Monitoring an iOS calendar in the background - how is it done?

I’m learning how to add notifications to our app when an event starts. Other calendar-only apps provide this functionality, but my research has puzzled me how they do it.

According to Apple docs: For tasks that require longer execution time for implementation, you must request specific permissions to run them in the background without pausing them. On iOS, only certain types of applications are allowed to run in the background:

  • Applications that play audio content to the user in the background, for example, an application for a music player
  • Applications that keep users informed of their location, such as a navigation application
  • Voice over Internet Protocol (VoIP) Applications
  • News applications that require downloading and processing new content
  • Applications regularly receiving updates from external accessories

Well, well, the calendar app is none of that. If I plan local notifications for my application to wake up periodically and check the calendar, this will not be enough, afaict from the reading I did. Using the location monitoring option is not enough - what if my user sits in his office all day?

Calendar events can be added / removed from other sources near the phone, obviously, therefore, setting up notifications when the application starts is not a solution.

How do calendar applications notify before events? I have several calendar apps from the App Store and they do this, so I know that it can be done. My application should be acceptable in the App Store, so I can not fake VoIP as a solution.

Additional information: after additional research, the applications that I see do this without updating when they were closed (duh), but they do some background updates. I still do not understand how to keep the background process for a long time (for example, at night).

+6
source share
1 answer

Mark this answer. You can subscribe to EKEventStoreChangedNotification to receive notifications of any changes to the calendar. fooobar.com/questions/949851 / ...

+3
source

Source: https://habr.com/ru/post/949850/


All Articles