如何将许多事件添加到 Google 日历 - Swift

How to add many events to Google Calendar - Swift

我有一个应用程序,我要在其中创建一个 Google 日历并同时向其中添加大量事件。 Google 日历 API 似乎不允许我在本地将事件添加到日历,然后通过请求插入日历,或者通过单个请求添加多个事件。所以我通常必须在一个循环中发出 40 个请求来添加我的所有事件,这通常会导致我收到“超出速率限制”的响应...

有什么办法可以实现吗?

根据一个非常相似的 post 的回答,关于 Insert multiple calendar.events in google calendar(API), it is advised to use the Batch 方法能够一次添加多个事件。但是,我不是Swift的专家,也不了解如何在Swift编程中实现批处理方法,但是你可以参考这篇文章。

此外,当您遇到 403: Rate Limit Exceeded error, it is suggested to use the exponential backoff method. Alternatively, you may also check Resolve a 403 error: Daily limit exceeded.