简体   繁体   English

iPhone使用字符串“当前位置”而非satdr的经纬度链接到地图方向

[英]iPhone link to map directions using string “current location” not lat and lng for saddr

I know there are numerous questions about how to construct a sharedApplication link to the maps app specifying the start and end address with coordinates. 我知道有很多问题,如何构建一个指向地图应用程序的sharedApplication链接,以指定坐标的开始和结束地址。 I've got that working no problem. 我的工作没问题。

Has anyone found a way to link with a source address generically specified as "current location". 有没有人找到一种方法来链接通常指定为“当前位置”的源地址。

I ask because the scenario I'm working on having Core Location or a UIMapView would only be necessary in order to determine the user location prior to handing off to the map app where the user locating would seem to just happen again. 我问是因为我正在尝试拥有Core Location或UIMapView的场景仅是为了在移交给要再次定位用户的地图应用之前确定用户位置才需要的。

I've tried throwing UTF8'd "Current Location" and "[Current Location]" into the saddr parameter which amusingly starts from Current Montana. 我尝试将UTF8的“当前位置”和“ [当前位置]”扔到saddr参数中,该参数有趣地从Current Montana开始。 I've also tried simply excluding the saddr param. 我也尝试过简单地排除saddr参数。

I know this is often tread territory but this particular situation wasn't covered by anything I found searching here or on mapki. 我知道这通常是艰巨的任务,但是这种特殊情况并没有被我在这里或mapki上搜索到的任何内容所涵盖。 Before I add the core location code I just wanted to make sure there wasn't a more limited way to tackle this. 在添加核心位置代码之前,我只是想确保没有更有限的方法来解决此问题。

Thanks 谢谢

This post is quite old, but recently I had to face a similar issue and I developed a solution. 这篇文章很老,但是最近我不得不面对一个类似的问题,并且我开发了一个解决方案。

Using "Current Location" (properly escaped) as source address works perfectly. 使用“当前位置”(正确转义)作为源地址可以很好地工作。 The downside is that "Current Location" is valid for English language only. 缺点是“当前位置”仅对英语有效。 If your iPhone is set to use another language, you need to know the exact translation that Apple chose for that particular language. 如果您的iPhone设置为使用其他语言,则需要了解Apple为该特定语言选择的确切翻译。

I wrote a class that can provide the exact translation for "Current Location" in any supported language. 我编写了一个类,可以使用任何受支持的语言为“当前位置”提供准确的翻译。 You can read my blog post about this. 您可以阅读关于此的博客文章

Hope this helps. 希望这可以帮助。

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

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