iPhone模拟器提供位置结果 [英] iPhone Simulator providing location results

查看:148
本文介绍了iPhone模拟器提供位置结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iOS SDK 4.2并遵循本教程: http:// mobileorchard。 com / hello-there-a-corelocation-tutorial / ,并在控制台上使用iPhone和iPad获得一些GPS日志。

然后我跑了它在模拟器上测试其他功能,并且CoreLocation日志正在击中locationManager:didFailWithError:方法,这是公平的,因为MacBookPro(OSX 10.6.6)没有GPS功能......或者我认为。



今天早上我再次在iPad上测试它,而不是在家中,现在在没有任何设备连接的情况下在iPhone模拟器上测试,模拟器提供了我的办公室位置结果(不,在库比蒂诺工作),水平精度每次在45-56米之间变化,最多只能给两个样本(大概是因为我的笔记本没有移动)。

现在我已经完全关闭了XCode和模拟器a nd从模拟器中删除了应用程序并执行了清理并重建,仍然获得我当前的坐标。我还可以在没有互联网接入的情况下复制它,因为模拟器对于某种GeoIP很棘手。



模拟器从哪里获得位置?

解决方案

从您的MacBook的IP地址,或者如果它在WiFi上, WiFi网络。由于它对你来说非常准确,所以它就是WiFi,因为IP地址方法通常只将它缩小到一个城市,或者最多只是一个城市的一部分。

为美国大部分WiFi网络以及其他部分地区提供地理位置信息世界,Apple订阅的信息。






编辑添加



显然苹果在去年4月份弃用了Skyhook,现在使用自己的数据库,但系统是一样的。就像Google在德国的热水中一样,有人开着计算机寻找WiFi网络并记录他们的位置。


I am using iOS SDK 4.2 and followed this tutorial: http://mobileorchard.com/hello-there-a-corelocation-tutorial/, and got some GPS logs happening on the console using both iPhone and iPad.

Then I ran it on the simulator to test other features and the CoreLocation logs were hitting the locationManager:didFailWithError: method which is fair because the MacBookPro (OSX 10.6.6) has no GPS functionality... or so I thought.

This morning I tested it on the iPad again at work instead of at home and now testing on the iPhone simulator without any device connected the simulator is providing my location results of my office (No I don't work in Cupertino) and the horizontal accuracy is varying between 45-56m each time and only giving two samples at most (presumably because my notebook isn't moving).

Now I have fully closed XCode and the simulator and deleted the app from the simulator and performed a clean and rebuild and still getting my current coordinate. I can also replicate it without internet access incase the simulator was being tricky with some sort of GeoIP.

Where is the simulator getting my location from?

I thought perhaps maybe the simulator stored some GPS location data when I used the iPad this morning but with no device connected and clean starting everything it is providing varying results eg +/- 0.000001 of a degree variations.

解决方案

From your MacBook's IP address or, if it's on WiFi, the stored location of your WiFi network. Since it's so accurate for you, it's the WiFi, since the IP address method generally narrows it only to a city, or at best, part of a city.

Skyhook provides geolocation information for most of the WiFi networks in the US and some other parts of the world, info that Apple subscribes to.


Edited to add

Apparently Apple ditched Skyhook last April and now uses its own database, but the system is the same. Much like Google got in hot water for in Germany, someone drives around with a computer looking for WiFi networks and recording their location.

这篇关于iPhone模拟器提供位置结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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