在模拟器中使用真实定位服务

发布于 2024-08-31 12:34:01 字数 43 浏览 1 评论 0原文

有没有办法仅在模拟器中使用真实位置服务(不涉及设备)?它总是去库比蒂诺。

Is there a way to use real location services in the simulator only (no device involved)? It always goes to Cupertino.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小情绪 2024-09-07 12:34:03

我认为不可能在模拟器中使用真实的位置数据,但是将 CLLocationManager 类包装在您自己设计的类中,并在模拟器中运行时提供来自您的类的测试数据是相当简单的,并且当您在设备上时使用 CoreLocation。

I don't think it's possible to use real location data in the simulator, but it's fairly trivial to wrap the CLLocationManager class in a class of your own design, and provide test data from your class when you're running in the simulator, and use CoreLocation when you're on the device.

能怎样 2024-09-07 12:34:03

是的,您可以借助 iSimulate 在模拟器中使用真实位置数据。您仍然需要真实设备,但真实设备只是将数据输入模拟器,因此您仍然可以使用来自设备的真实位置、加速度计等数据在模拟器上继续测试其所有优势(速度!)。

Yes, you can use real location data in simulator with the help of iSimulate. You still need the real device, but the real device just pumps data into simulator, so you can still keep testing on simulator with all its benefits (speed!) with real location, accelerometer etc data from device.

初相遇 2024-09-07 12:34:03

不,您必须部署到您的设备。

根据您的生活有多困难,以及您在做什么,您也许可以使用 条件编译 以运行仅在模拟器中运行的自定义定位器代码块。这样你就可以设置某种硬编码的位置值来读取,或者其他东西。

Nope, you'll have to deploy to your device.

Depending on how difficult that makes your life, and depending on what you are doing, you might be able to use conditional compiling to run a block of custom locator code that only runs in the simulator. That way you can set up some sort of hard-coded location values to read from, or something.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文