Programming for ios: Difference between calendars/lists in Calendar/Reminders applications (ios) on newest questions tagged ios – Stack Overflow
My iOS application creates calendar, populates it with events and sometimes adds new events. It stores ID of created calendar and works only with it. Anyway, in some cases this calendar may get deleted, for example, if user turns off sync with iCloud and chooses to remove existing calendars. I want to be able to know that calendar was deleted, so that I can create new one and populate it once again. The obvious approach I’ve tried is to look for calendar with ID that my app stores, and if calendar with this ID was not found, consider it was deleted. But this approach does not work.
Here is the problem:
When event with alarm is added to calendar, this calendar starts to appear not only in Calendar application, but also in Reminders application. When user turns off iCloud for Calendars and chooses to delete existing calendars, only calendar from Calendar app gets deleted. Calendar in Reminders app remains. Remained calendar still has the same ID, so it’s impossible to recognize calendar’s deletion by ID. Also this calendar stops allowing to add event. When app tries to add event to this calendar, the exception is raised “That calendar does not support items of that type”.
I would like to determine that ‘real’ calendar for events got deleted. I tried comparing calendars before and after deletion. But following properties remained the same: allowsContentModifications, CGColor, immutable, title, type, source, subscribed, supportedEventAvailabilities, calendarIdentifier, description.
Have anyoune encountered same problems? Any ideas on how to distinguish “calendar for events and alarms” from “calendar for alarms only”?
(The only thing I can think up is to try to add test appointment, and if this operation fails, consider calendar is “for alarms only”. But that’s not convenient)
Programming for ios: programming-for-ios