如何获取 iOS 上多个目的地的预计到达时间?

How to get estimated time of arrival to multipe destinations on iOS?

我有一个应用程序有 10 个不同地方的位置。

鉴于您当前的位置,该应用程序应该 return 这 10 个位置的 estimated arrival time

然而,Apple已经说过

Note: Directions requests made using the MKDirections API are server-based and require a network connection. There are no request limits per app or developer ID, so well-written apps that operate correctly should experience no problems. However, throttling may occur in a poorly written app that creates an extremely large number of requests.

问题是他们没有定义什么是写得很好的应用程序。 10 个请求不好吗? 20 个请求是不是很大?

有没有人做过这样的应用程序来提供一些指导?如果 Apple 确实开始限制请求,那么人们会责怪我的应用程序而不是 Apple。请多多指教..

您好调查classMKRoute此class包含您需要的所有信息。

这个对象包含

expectedTravelTime

你还应该考虑LoadingThrottled

The data was not loaded because data throttling is in effect. This error can occur if an app makes frequent requests for data over a short period of time.

为防止您的请求 bing 受到限制,请减少请求数量。 尝试使用 Completion Handlers 来了解您的请求是否已完成,并且仅在发送另一个请求或取消之前的请求之后。根据我的经验,尝试像处理常规网络请求一样处理此请求,只是确保您没有向 Apple API 发送不必要的请求。但这并不能 100% 保证 Apple 不会限制您的请求。