简体   繁体   English

MKLocalSearch生成没有URL的MKMapItems

[英]MKLocalSearch produces MKMapItems with no URL

I have an app that relies on the url property of the MKMapItem class. 我有一个依赖于MKMapItem类的url属性的应用程序。

In the past (as recently as a few months ago) I was able to do a local search for any US city and receive an MKMapItem instance which contained a URL for that location, such as a Wikipedia URL. 过去(几个月前),我能够在本地搜索任何美国城市,并收到一个MKMapItem实例,其中包含该位置的URL,例如Wikipedia URL。

For some reason this appears to be broken now and all the MKMapItem instances returned by MKLocalSearch contain a nil URL. 由于某种原因,这似乎现在已被破坏,并且MKMapItem返回的所有MKMapItem实例MKLocalSearch包含nil URL。 Here's my code: 这是我的代码:

let request = MKLocalSearchRequest()

// Replace with any city, like "San Francisco, CA"
request.naturalLanguageQuery = "Seattle, WA"

// Start the local search.
MKLocalSearch(request: request).start { (response, error) in

    // Omitting error handling for brevity.
    let mapItems = response?.mapItems {
        for mapItem in mapItems {
            // mapItem.url is always nil here!!
        }
    }
}

I've submitted a code-level support ticket, since this absolutely used to work just fine. 我已经提交了代码级支持票证,因为这绝对可以正常工作。 Will post here when I hear back. 收到回复后将在这里发布。 In the meantime, has anyone else ran into this issue? 同时,是否还有其他人遇到过此问题?

Appears to be a MapKit bug. 似乎是MapKit错误。 I've submitted a bug report with Apple. 我已经向Apple提交了错误报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM