我可以使用Xcode模拟器测试显着变化吗? [英] Can I test Significant-Change with Xcode simulator?

查看:78
本文介绍了我可以使用Xcode模拟器测试显着变化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我是否可以在Xcode Simulator中测试重要更改位置服务(startMonitoringSignificantLocationChanges方法),或者它只能在实际设备中使用。
注意,我已经在模拟器中尝试了它并且它不起作用,但我不确定这是否只是因为它在模拟器上不起作用或因为我做错了。

I wonder if I could test Significant-Change location service (startMonitoringSignificantLocationChanges method ) in Xcode Simulator or it just only works in actual device. 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.

谢谢

推荐答案

我之前在SO上回答了这个问题,并且使用模拟器不是测试-startMonitoringSignificantLocationChanges的准确方法。

I've answered this question before on SO, and using the simulator is not an accurate way to test for -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.

另一种方法是测试您可能想要在回调中执行的任何逻辑-didUpdateToLocation并改为使用-startUpdatingLocation。虽然这是电池寿命的一大缺点,但它可以让您获得准确的位置更新以进行测试。当您在模拟器中解决所有问题后,将所有内容转移到重要位置更改方法并在设备上进行测试。

One alternative is to test any logic you may want to perform inside your callbacks for -didUpdateToLocation and use -startUpdatingLocation instead. 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.

希望这会有所帮助。

这篇关于我可以使用Xcode模拟器测试显着变化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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