Can I test Significant-Change with Xcode simulator?

前端 未结 2 2315
滥情空心
滥情空心 2021-02-19 20:21

I wonder if I could test Significant-Change location service (startMonitoringSignificantLocationChanges method ) in Xcode Simulator or it just only works in actual device. Notic

相关标签:
2条回答
  • 2021-02-19 21:10

    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.

    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.

    Hope this helps.

    0 讨论(0)
  • 2021-02-19 21:10

    See XCode / iOS simulator: Trigger significant location change manually. 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.

    0 讨论(0)
提交回复
热议问题