我在创建日历时遇到问题,我已从iCloud退出以删除所有其他合并的日历。现在,只剩下Gmail和雅虎日历,gmail是我的默认日历。我想创建自己的日历并将其标记为默认日历,但不能。
我使用此eventStore.defaultCalendarForNewEvents.source
为我新创建的日历指定了源代码并得到了一些错误
“此来源不允许编辑内容等。”
虽然此代码返回true print(eventStore.defaultCalendarForNewEvents.allowsContentModifications)
有没有办法创建自己的,因为我们可以看到谷歌,雅虎等其他应用程序创建了自己的应用程序。这是创建新日历的代码
let newCalendar = EKCalendar(for: .event, eventStore: eventStore)
newCalendar.title = "Test Calendar"
do {
newCalendar.source = eventStore.defaultCalendarForNewEvents.source
try eventStore.saveCalendar(newCalendar, commit: true)
} catch {
let alert = UIAlertController(title: "Calendar could not save", message: error.localizedDescription, preferredStyle: .alert)
let OKAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(OKAction)
self.present(alert, animated: true, completion: nil)
}
由于