Ios 用Swift计算预计到达时间
我试图在swift中计算两个位置之间的估计旅行时间(步行),用户可以使用注释 这是我当前的代码,它不会抛出任何使程序崩溃的错误,但只返回“请求ETA时出错” 控制台在非常长的行中看起来像这样Ios 用Swift计算预计到达时间,ios,swift,mapkit,Ios,Swift,Mapkit,我试图在swift中计算两个位置之间的估计旅行时间(步行),用户可以使用注释 这是我当前的代码,它不会抛出任何使程序崩溃的错误,但只返回“请求ETA时出错” 控制台在非常长的行中看起来像这样 2017-05-26 13:53:51.583 Toilet Locator[2568:181698] didFailWithError Error Domain=GEOErrorDomain Code=-3 "(null)" UserInfo={GEORequestThrottleStateLev
2017-05-26 13:53:51.583 Toilet Locator[2568:181698] didFailWithError Error Domain=GEOErrorDomain Code=-3 "(null)" UserInfo={GEORequestThrottleStateLevel=0, GEORequestThrottleStateResetTimeRemaining=34.019131004810333}
2017-05-26 13:53:51.584 Toilet Locator[2568:181698] didFailWithError Error Domain=GEOErrorDomain Code=-3 "(null)" UserInfo={GEORequestThrottleStateLevel=0, GEORequestThrottleStateResetTimeRemaining=34.018206000328064}
Error while requesting ETA : Directions Not Available
Error while requesting ETA : Directions Not Available
我希望得到一些指导,谢谢大家
注意:ViewController连续多次调用该类,因此不确定这是否会导致Apple拒绝ETA请求?能否添加显示如何调用该函数的代码?每隔五秒钟,计时器会使用MKLocalSearch请求触发一个函数。任何未添加到地图的注释(可能是10+)都将一个接一个地初始化到此“LocationObjects”类中,该类中的每个对象都会引发“请求ETA时出错:方向不可用”。根据错误的措辞
userInfo
(GEORequestThrottleStateLevel
,GEORequestThrottleStateResetTimeRemaining
)听起来确实像是苹果限制了你可以调用路由API的次数。不幸的是,似乎没有记录此错误信息(我可以看到)因此,我建议您尽量限制调用的次数。例如,不要使用计时器,而是仅在用户位置更改时调用API(并在CLLocationManager
上使用distanceFilter
)限制你放入这个类的对象的数量。谢谢你!看来我得找个办法才能多次调用它。
2017-05-26 13:53:51.583 Toilet Locator[2568:181698] didFailWithError Error Domain=GEOErrorDomain Code=-3 "(null)" UserInfo={GEORequestThrottleStateLevel=0, GEORequestThrottleStateResetTimeRemaining=34.019131004810333}
2017-05-26 13:53:51.584 Toilet Locator[2568:181698] didFailWithError Error Domain=GEOErrorDomain Code=-3 "(null)" UserInfo={GEORequestThrottleStateLevel=0, GEORequestThrottleStateResetTimeRemaining=34.018206000328064}
Error while requesting ETA : Directions Not Available
Error while requesting ETA : Directions Not Available