iOS 9中的geocodeAddressDictionary是否可以与iOS 8不同地实现 [英] Could geocodeAddressDictionary in iOS 9 be implemented different from iOS 8

查看:184
本文介绍了iOS 9中的geocodeAddressDictionary是否可以与iOS 8不同地实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遍历一组地址,并对每个地址执行地址解析.

I am looping through a set of addresses and performing a geocode on each one.

    for aClient in passedPossible {

        let geocoder = CLGeocoder()

        let checkAddress = [
            CNPostalAddressStreetKey:aClient[CNPostalAddressStreetKey]!,
            CNPostalAddressCityKey:aClient[CNPostalAddressCityKey]!,
            CNPostalAddressPostalCodeKey:aClient[CNPostalAddressPostalCodeKey]!,
            CNPostalAddressCountryKey:"Australia"
        ]


        geocoder.geocodeAddressDictionary(checkAddress, completionHandler: { (placemarks, error) -> Void in

// Etc do stuff...

    }

在iOS 8.4中,我可以传递250个项目,遍历并获得每个项目的回叫.

In iOS 8.4 i am able to pass in 250 items, loop through and get a call back for each one.

但是在具有相同代码的iOS 9.0中,它失败了,除了大约40个项目之外,我都出现了错误.

But in iOS 9.0 with the same code it fails, giving me errors for all but about 40 items.

我得到的错误是

错误域= kCLErrorDomain代码= 2

Error Domain=kCLErrorDomain Code=2

我认为苹果不喜欢我进行批量地理编码吗?

I assume apple doesn't like me bulk geocoding ?

但是为什么它不能在8.4中运行,而现在不能在9.0中运行

But why does it work in 8.4 and not now in 9.0

我想我需要使用mapQuest吗?

I guess I need to use mapQuest ?

感谢您的任何输入.

推荐答案

iOS 9对文档中的此声明可能有更多限制:

iOS 9 might be more restrictive about this statement in the documentation:

每个应用程序的地址解析请求都受到速率的限制,因此产生了太多请求 短时间内的请求可能会导致某些请求 失败.当超出最大速率时,地理编码器会传递错误 值为kCLErrorNetwork的对象添加到您的完成处理程序.

Geocoding requests are rate-limited for each app, so making too many requests in a short period of time may cause some of the requests to fail. When the maximum rate is exceeded, the geocoder passes an error object with the value kCLErrorNetwork to your completion handler.

这篇关于iOS 9中的geocodeAddressDictionary是否可以与iOS 8不同地实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆