如果用户使用非iOS帐户,则以编程方式向日历应用添加新日历 [英] Adding a new calendar programmatically to calendar app if user is using non iOS account
问题描述
如果用户将其他帐户用于yahoo或hotmail等日历,是否可以通过编程方式将新日历添加到默认日历应用中,我得到以下错误提示:
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代码= 17该帐户不允许添加或删除日历."
Domain=EKErrorDomain Code=17 "That account does not allow calendars to be added or removed."
如果用户使用icould或ios日历,则代码工作得很好
Code works perfectly fine if user is using icould or ios calendars
推荐答案
最后,经过几天的大量研究,我发现Google,yahoo之类的EKExchange
日历不允许我们在其日历中添加事件.如果是这种情况,您将得到错误代码17的错误,如下所示:
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.
这篇关于如果用户使用非iOS帐户,则以编程方式向日历应用添加新日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!