[英]Can I test Significant-Change with Xcode simulator?
I wonder if I could test Significant-Change location service (startMonitoringSignificantLocationChanges method ) in Xcode Simulator or it just only works in actual device. 我想知道我是否可以在Xcode Simulator中测试重要更改位置服务(startMonitoringSignificantLocationChanges方法),或者它只适用于实际设备。 Notice, I already tried it in Simulator and it didn't work, but I'm not sure if this only because it don't work on simulator or because I did something wrong.
请注意,我已经在模拟器中尝试了它并且它不起作用,但我不确定这是否只是因为它不能在模拟器上工作或因为我做错了什么。
Thanks 谢谢
See XCode / iOS simulator: Trigger significant location change manually . 请参阅XCode / iOS模拟器:手动触发重要的位置更改 。 You CAN simulate significant location changes but it can takes about 5 minutes before you get an update if you're using the simulator's "freeway drive" location debug mode.
您可以模拟重要的位置更改,但如果您使用模拟器的“高速公路驱动器”位置调试模式,则可能需要大约5分钟才能获得更新。
I've answered this question before on SO, and using the simulator is not an accurate way to test for -startMonitoringSignificantLocationChanges. 我之前在SO上回答了这个问题,使用模拟器并不是测试-startMonitoringSignificantLocationChanges的准确方法。
This method relies primarily on cell-tower triangulation and hand offs. 该方法主要依赖于细胞塔三角测量和切换。 You can occasionally get an initial fix from the simulator, but that is it.
您可以偶尔从模拟器获得初始修复,但就是这样。 It won't update any other location after that.
之后它不会更新任何其他位置。 You will have to test on device to see if your program is responding properly to this method.
您必须在设备上进行测试,以查看您的程序是否正确响应此方法。
One alternative is to test any logic you may want to perform inside your callbacks for -didUpdateToLocation and use -startUpdatingLocation instead. 另一种方法是测试您可能想要在-didUpdateToLocation的回调中执行的任何逻辑,而是使用-startUpdatingLocation。 While this is a big drawback for battery life, it will allow you to get accurate location updates for testing.
虽然这是电池寿命的一大缺点,但它可以让您获得准确的位置更新以进行测试。 When you have all your kinks worked out in the simulator, transfer everything over to the significant location change methods and test on-device.
如果您在模拟器中解决了所有问题,请将所有内容转移到重要位置更改方法并在设备上进行测试。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.