5

Can we add a new calendar to default calendar app programmatically if user is using any other account for calendars like yahoo or hotmail, I am getting following error:

Domain=EKErrorDomain Code=17 "That account does not allow calendars to be added or removed."

Code works perfectly fine if user is using icould or ios calendars

Cœur
  • 37,241
  • 25
  • 195
  • 267
Bhumit Mehta
  • 16,278
  • 11
  • 50
  • 64
  • 1
    Hey, have you found an answer for this, http://stackoverflow.com/a/13991658/921573 worked for me, until I got users who have iCloud off and Gmail calendars on. – MiMo Dec 23 '13 at 12:21
  • I ended up giving alert to users if sync fails due to this particular reason. As there seems to be no way to access outlook or mail calenders. – Bhumit Mehta Dec 29 '13 at 06:51
  • What I ended up doing is just using the calendar in "defaultCalendarForNewEvents"... At least users can create an event in their default calendar, if there is nothing else available. – MiMo Jan 03 '14 at 21:59
  • @Siten . I did not find any solution, ended up giving alert to users if sync fails due to this particular reason – Bhumit Mehta Jun 17 '14 at 12:17
  • Yes, Like apple is also going with that. But I mean apple must keep their default calendar with device. It should not be hidden after adding another CalDev account. – Siten Jun 26 '14 at 04:40

1 Answers1

5

Finally after a lot of research for few days , i found that Some EKExchange calendars like google , yahoo does not allow us to add events in their calendars . And if that is the case than you will get error with error code 17 as follows

"Domain=EKErrorDomain Code=17 "That account does not allow calendars to be added or removed." "

There is nothing we can do about this error, So i ended up giving alert to user that "We do not have rights to access your calendar account". Hope this helps someone if they face similar issue.

Bhumit Mehta
  • 16,278
  • 11
  • 50
  • 64
  • Is there any way to undestend if access granded before we get such error. calendar.isImmutable == NO && calendar.allowsContentModifications == YES. And it is the same when I get such error or everything is ok. – Nuzhdin Vladimir May 20 '16 at 14:08