iPhone 上的地理定位问题
我按照本教程为当前用户位置开发了一个简单的程序: http://www.youtube.com/watch?v=qNMNRAbIDoU
但是,当我构建时并运行,显示地图,但库比蒂诺位置(苹果总部)不在地图上。
我听说问题可能是苹果无法识别我的wifi或类似的东西,这可能吗?如果是的话,我应该保留我的代码并假设它是真的,然后等待稍后在设备上测试它吗?提前致谢
I have developed a simple program for current user location following this tutorial :
http://www.youtube.com/watch?v=qNMNRAbIDoU
However when I build and run, the map is shown but the cuppertino location (apple headquarters) is not located on the map.
I heard that the problem may be that apple didn't recognize my wifi or something like that, is this possible, and if so, should I keep my code and suppose it to be true and so wait to test it on device later? Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保你看到教程的结尾,因为他在方法名称上犯了一个错误,他纠正了这个错误,说实话,它看起来不像一个很好的教程,我会找到另一个。
Make sure you watch to the end of the tutorial as he makes a mistake on the method name, which he corrects, to be honest it doesn't look like a very good tutorial, I'd find another.
在模拟器中,蓝点将始终精确定位母舰。
然而,mapView.userLocation.coordinate实际上会返回您当前的位置坐标(基于Wifi,所以请确保它已打开)。
但请注意,在 4.0 之前的版本中,mapView.userLocation.coordinate 返回母舰的坐标。
一旦您开始在设备上进行测试,蓝点将正确显示在您的 MKMapView 中。使用 CLLocation 和 MKMapView 时,请务必在设备上测试您的应用程序,尤其是当您依赖用户位置进行任何操作时。好吧,请务必在设备上测试您的应用程序:)
In Simulator, the blue dot will always pinpoint the Mothership.
However, mapView.userLocation.coordinate will in fact return your current location coordinate (based on Wifi, so be sure it's on).
Note, though, in pre-4.0, mapView.userLocation.coordinate is returns the coordinates for the Mothership.
Once you start testing on your device the blue dot will appear correctly in your MKMapView. Be sure to test your app on a device when using CLLocation and MKMapView, especially if you rely on the users location for anything. Well, always be sure to test your app on a device :)