执行反向地理定位查找
我对 iPhone SDK 和 Cocoa 开发还很陌生。 我想知道如何调用 Web 服务,该服务将从我的 iPhone 获取经纬度值并将其提供给 Web 服务,以便我可以检索城市、州。 我已经把手机定位的东西摆好了。 我只是在寻找应该将此信息传递到哪里以及如何将此数据解析回我的应用程序。
本质上,我只希望“城市,州”在我的视图之一的标签中可见。
我第一次尝试这个是在 geonames.org 上,它把我返回的纬度/经度位置放在离我实际位置很多很多英里的地方。 我使用谷歌地图 API 尝试了相同的纬度/经度值,它位于正确的位置。 我遇到的唯一问题是将 JSON 数据解析回我的应用程序。 返回的信息似乎有相同信息的多个版本,我似乎无法理解它是如何工作的。
那么再一次。 只需寻找一个简单的 HTTP 样式字符串,我可以将我的 lat/lng 值传递到某处,它会返回“City,State”。 如果你提到的例子涉及到解析数据。 请参考我可以剖析的一个例子 - 我是一个菜鸟。
哦,最后一件事,我知道使用 iPhone 3.0 SDK 可能会更容易,但我目前正在 2.2.1 上构建这个项目 - 并且出于足够的原因必须这样做,直到应用程序的其余部分完成移植到3.0。
I'm pretty new to iPhone SDK and Cocoa development. I'd like to know how to call a web service which will take the lat and long values from my iPhone and feed them to a webservice so I can retrieve the City,State. I already have the phone location stuff squared away. I'm only looking for where I should pass this info to and how I can parse this data back into my app.
Essentially, I only want "City,State" to be visible in a label on one of my views.
The first time I tried this was with geonames.org and it put my returned lat/lng location in the middle of nowhere many many many miles from where I actually was. I tried the same lat/lng values with google maps api and it was in the right place. The only problem I've had is parsing the JSON data back into my app. The returned info seems to have multiple versions of the same info which I can't seem to understand how that works.
So once again. Just looking for a simple HTTP style string I can pass somewhere with my lat/lng values and it returns "City,State". If the example you mention involves parsing data. Please refer to an example I can dissect - I'm a noob.
Oh and one last thing, I know this was made possibly easier with the iPhone 3.0 SDK but I'm currently building this project on 2.2.1 - and for more than enough reason HAVE to do it this way until the rest of the app is ported to 3.0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看此处和此处
Look at the replies here and here