[英]Error when saving EKEvent into EKEventStore (exporting to calendar)
My automated report has been showing a growing issue in exporting into the user calendars with the error:我的自动报告显示在导出到用户日历时出现越来越多的问题,并出现以下错误:
NSInternalInconsistencyException
Trying to set the object ID on an object that has one!
When I'm calling当我打电话时
do {
try store.save(event, span: .thisEvent)
return event.eventIdentifier
} catch {
Log.error(error.localizedDescription)
}
I'm currently having a hard time reproducing the error, or even finding any open topics online.我目前很难重现错误,甚至很难在线找到任何开放主题。 It seems to be happening on iOS 14. Has someone faced it?好像在iOS上发生 14.有人面对过吗? Any suggestions?有什么建议么?
I had same problem and I found solution.我有同样的问题,我找到了解决方案。 Do store.save in main thread.在主线程中执行 store.save。
DispatchQueue.main.async {
do {
try self.eventStore.save(event, span: .thisEvent)
} catch let error as NSError {
print("failed to save event with error : \(error)")
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.