简体   繁体   English

我可以使用Xcode模拟器测试显着变化吗?

[英]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.

相关问题 StartUpdatingLocation与重要更改位置服务 - StartUpdatingLocation Vs significant-change location service 与startMonitoringForRegion相比,注册重大变更位置:desiredAccuracy: - Registering for significant-change location versus startMonitoringForRegion:desiredAccuracy: 我可以在Xcode中更改模拟器顺序吗? - Can I change the simulator order in Xcode? Xcode / iOS 模拟器:手动触发重大位置变化 - Xcode / iOS simulator: Trigger significant location change manually 如何更改Xcode模拟器的默认文件名屏幕快照? - How can I change default file name Xcode simulator screenshots? 如何确定iOS设备是否具有蜂窝功能来启动重大更改位置服务? - How to determine iOS device has cellular capability to start significant-change location service or not? 重大更改位置服务将使用Wi-Fi还是移动数据? - Significant-Change Location Service will use Wi-Fi or Mobile Data? 带有UIBackgroundMode位置键的应用与使用重大更改位置服务的应用之间有什么区别? - What is the difference between an app with a UIBackgroundMode key of location and an app that uses the significant-change location service? Swift 中的显着变化定位服务与标准定位服务 - Significant-Change Location Service vs. Standard Location Service in Swift iOS标准位置服务与重要变更位置服务与区域监控 - iOS standard location service vs significant-change location service vs region monitoring
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM