设置iPhone模拟器的当前位置
我想解释一下我面临的情况。默认情况下,iPhone 模拟器的当前位置是“loop”。我有一个正在南非使用的应用程序(例如)。如果我在模拟器上测试“靠近我”的功能。它不会显示任何内容。同样,如果我想在真实设备上测试我的应用程序,它对我来说不起作用,因为我位于印度。我要做的是“在模拟器上设置当前位置”。黑莓模拟器和Android 模拟器/模拟器提供 - 设置当前位置以在模拟器上进行测试。
你会做什么来摆脱这种情况?
I would like to explain the situation that I am facing. By default iPhone simulator's current location is "loop". I have an application that is being using in south Africa ( for example ). If I test "near me" functionality on simulator. It will show nothing. Similarly If I want to test my application on real device, It will not work for me as I am situated in India. What I have to do is "set current location on simulator". Blackberry simulator & Android simulator/emulator provides - set current location for testing on emulator.
What do you do to come out over this situation ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 iOS5 模拟器上,默认情况下它会显示美国的某个位置。如果您想更改该位置,请在 iOS Simulator 菜单中,转到 Debug ->位置->自定义位置。您可以在那里设置纬度和经度并相应地测试应用程序。这适用于 mapkit 和 CLLocationManager。
On iOS5 Simulator by default you it will show some location in USA. If you want to change that location, in iOS Simulator menu, go to Debug -> Location -> Custom Location. There you can set the latitude and longitude and test the app accordingly. This works with mapkit and also with CLLocationManager.
您必须使用要测试的位置的坐标创建自己的 CLLocation 对象。
(获取经度和纬度坐标的一种方法是使用 Google 地图。在 Google 地图中找到您要使用的地点。单击“链接”按钮。在 URL 中查找“ll”参数。这是经度和纬度)
使用坐标创建您自己的
CLLocation
:CLLocation
使用CLLocationDegrees
,但这只是常规double 的 typedef
。You have to create your own
CLLocation
object with the coordinates for the place you want to test with.(One way to get the longitude and latitude coordinates is by using Google Maps. Find the place you want to use in Google Maps. Click the "Link"-button. Look in the URL for the "ll"-parameter. This is the longitude and latitude)
Use the coordinate to create your own
CLLocation
:CLLocation
usesCLLocationDegrees
, but that's just a typedef for a regulardouble
.是的,它正在工作..
谢谢..
Yes its working..
Thanks..
您必须使用南非的一些纬度和经度进行硬编码,并将该纬度和经度设置为当前位置。然后使用硬编码的纬度和经度测试应用程序
You will have to hardcode with some lat and long in southafrica and set that lat and long as the current location. Then test the app with that hardcoded lat and long