在模拟器中使用真实定位服务
有没有办法仅在模拟器中使用真实位置服务(不涉及设备)?它总是去库比蒂诺。
Is there a way to use real location services in the simulator only (no device involved)? It always goes to Cupertino.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为不可能在模拟器中使用真实的位置数据,但是将 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.
是的,您可以借助 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.
不,您必须部署到您的设备。
根据您的生活有多困难,以及您在做什么,您也许可以使用 条件编译 以运行仅在模拟器中运行的自定义定位器代码块。这样你就可以设置某种硬编码的位置值来读取,或者其他东西。
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.