是否可以通过iOS模拟器获取“实时”当前位置? [英] Is it possible to get the 'live' current location with an iOS Simulator?

查看:645
本文介绍了是否可以通过iOS模拟器获取“实时”当前位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用iOS模拟器测试我的位置代码。

I'm trying to test out my location code with an iOS Simulator.

如何让iOS模拟器使用我的实际位置?因此,例如,我在火车上使用我的MBP通过我的iPhone teathering连接到interwebs。然后我运行iOS模拟器并双击我的应用程序。

How can I make the iOS simulator use my -real- current location? So for example, i'm on a train using my MBP connected to the interwebs via my iPhone teathering. I then run the iOS Simulator and double click on my App.

现在..当火车移动时,我希望看到我的标签/控制台输出中的纬线/长线变化。我不是在代码之后(我已经完成了所有这些)...只是不确定如何告诉iOS模拟器使用真实的实时位置。

Now .. as the train moves, I wish to see my lat/long coords change in my labels / console output. I'm not after code (i've done all that)... just not sure how to tell the iOS Simulator to use the real live location stuff.

I知道iOS模拟器有 Debug-> Location - > 东西 - 这是我到目前为止所使用的东西。

I know the iOS simulator has the Debug->Location-> stuff -which is what i've been using so far.

其次,我知道MPB没有没有GPS(按照说法),但它有位置感知服务......这意味着它可以(神奇地)猜测一个纬度/长度...我希望iOS模拟器可以利用它。

Secondly, I understand that a MPB doesn't have a GPS (per say) but it DOES have Location aware services ... meaning it can (magically) guess a lat/long .. which i was hoping the iOS Simulator might leverage.

这里是我在MPB上安装的应用程序的屏幕,可以(正确地)得到一个很好的猜测Lat / Long。

here's a screenie of an app I have installed on my MPB that does (correctly) get a good guess Lat/Long.

那么还有另一种方法可以获得这个工作?

So is there another way I can get this to work?

这里的答案是否正确=>不要使用iOS模拟器但是运行`D中的代码EBUG | iPhone'主动配置..这意味着(我希望我有这个权利..)我需要通过usb线将我的iPhone连接到我的MBP ..然后它通过usb线将我的应用程序部署到我的iPhone上。然后使用iPhone作为硬件设备..其中包括GPS?

Is the correct answer here => do not use the iOS Simulator but run the code in `DEBUG|iPhone' active configuration .. which means (I hope I have this right..) I need to connect my iPhone to my MBP via the usb cable .. and then it deploys my app over the usb cable, to my iPhone .. and then uses the iPhone as the hardware device .. which include the GPS in it?

例如......

推荐答案

iPhone模拟器正是如此,它模拟了您的地理位置。它本身并不知道你在哪里,因此不能给你真正的坐标。

iPhone Simulator does exactly that, it simulates your Geo location. By itself it doesn't know in real life where you are and hence cannot give you real coordinates.

关于这些功能的文档,我从Apple文档中得到了这个。

In terms of documentation of what these functions do, I got this from Apple docs.


位置

Location

允许您设置应用使用的核心位置。从不同的位置设置中选择

Allows you to set the Core Location to be used by your app. Choose from the different location settings:


  • 无。不返回位置。用于测试当没有位置数据时应用如何响应。

  • None. Does not return a location. Use for testing how an app responds when no location data is available.

自定义位置。允许使用自定义纬度和经度。 Apple商店。使用Apple零售店的坐标。

Custom Location. Allows use of a custom latitude and longitude. Apple Stores. Uses the coordinates for an Apple Retail Store.

Apple。使用Apple总部的坐标。

Apple. Uses the coordinates of the Apple Headquarters.

城市自行车骑行。模拟在加州库比蒂诺骑自行车。此选项模拟设备在预定义路线上移动。

City Bicycle Ride. Simulates a bike ride in Cupertino, CA. This option simulates the device moving on a predefined route.

城市运行。模拟加州库比蒂诺的一次跑步。此选项模拟设备在预定义路线上移动。

City Run. Simulates a run in Cupertino, CA. This option simulates the device moving on a predefined route.

高速公路驾驶。模拟通过加州库比蒂诺的驱动器。此选项模拟设备在预定义路线上移动。

Freeway Drive. Simulates a drive through Cupertino, CA. This option simulates the device moving on a predefined route.

您可以在此处阅读更多相关信息

这篇关于是否可以通过iOS模拟器获取“实时”当前位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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