问题标签 [mklocalsearchrequest]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
51 浏览

swift - MapKit SearchResultsUpdating 未调用

有人可以查看我的代码吗?我正在尝试使用 MapKit 来获取本地搜索结果。我使用了本教程:https ://www.thorntech.com/2016/01/how-to-search-for-location-using-apples-mapkit/

与教程和我正在做的不同之处在于我不想显示 mapView。我只想单击按钮,然后会弹出一个 searchController 允许我搜索位置。我遇到的问题是 SearchResultsUpdating 没有被调用。抱歉,代码很长,这是我第一次使用 MapKit 本地搜索,我不知道我错过了什么。

*编辑它是固定的。附上修改后的代码。

0 投票
0 回答
92 浏览

ios - MapKit:MKLocalSearch 给出不完整的响应

我在 Swift 5 中使用 MapKit 时遇到问题。我正在使用一个自然搜索查询。如果我输入特定的街道,它只会给我一个或几个选项,而一些使用的街道名称在附近的几个城镇中使用。

该请求还通过输入在城镇之间切换。每隔一个字母就是 A 镇,否则就是 B 镇。我哪里错了,我在这个查询中没有设置什么?

0 投票
1 回答
239 浏览

swift - Making multiple map local searches synchronously

I try to make multiple searches synchronously (I mean one after the other, waiting for the previous request to complete before running the next one) and block till all the operations are complete before going ahead.

But completion handle of the local search looks like blocked and run once the semaphore gives up. I have made many attempts without success.

My code and logs are as follows (you can copy/paste to the playground):

The current bogus output:

[UPDATE]

The expected output should show no ***Warning and All done as the last line, as follows (the exact order of the numbering depends on the network conditions):

[UPDATE 2] the outputted when uncommenting the line //queue.maxConcurrentOperationCount = 1

search(:in:centered:id:): local search on the 0th portion 2020-03-28 23:49:41 +0000 search(:in:centered:id:): waiting for the 0th portion to complete 2020-03-28 23:49:41 +0000 search(:in:centered:id:): ***Warning: 0th timeout, job incomplete 2020-03-28 23:49:46 +0000 search(:in:centered:id:): local search on the 1th portion 2020-03-28 23:49:46 +0000 search(:in:centered:id:): waiting for the 1th portion to complete 2020-03-28 23:49:46 +0000 search(:in:centered:id:): ***Warning: 1th timeout, job incomplete 2020-03-28 23:49:51 +0000 search(:in:centered:id:): local search on the 2th portion 2020-03-28 23:49:51 +0000 search(:in:centered:id:): waiting for the 2th portion to complete 2020-03-28 23:49:51 +0000 search(:in:centered:id:): ***Warning: 2th timeout, job incomplete 2020-03-28 23:49:56 +0000 search(:in:centered:id:): local search on the 3th portion 2020-03-28 23:49:56 +0000 search(:in:centered:id:): waiting for the 3th portion to complete 2020-03-28 23:49:56 +0000 search(:in:centered:id:): ***Warning: 3th timeout, job incomplete 2020-03-28 23:50:01 +0000 All done 2020-03-28 23:50:01 +0000 0 got Optional(10) items 2020-03-28 23:50:02 +0000 3 got Optional(10) items 2020-03-28 23:50:02 +0000 2 got Optional(10) items 2020-03-28 23:50:02 +0000 1 got Optional(10) items 2020-03-28 23:50:02 +0000

Note: Btw, I also added \(Date()) at the end of each print

0 投票
0 回答
20 浏览

ios - MKLocalSearch:操作无法完成。(MKErrorDomain 错误 3。)

我想用来MKLocalSearch从用户在文本字段中键入的文本中获取地理位置结果。由于文本经常更新,我在输入几个字符后最终得到这个错误:

操作无法完成。(MKErrorDomain 错误 3。)

这是我的代码:

我应该怎么做才能避免这种情况?

谢谢您的帮助