12

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.

Thanks

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
user836026
  • 10,608
  • 15
  • 73
  • 129

2 Answers2

15

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.

Community
  • 1
  • 1
Ryan H.
  • 7,374
  • 4
  • 39
  • 46
  • Correct answer. Thanks – user1244109 Jan 21 '16 at 23:13
  • 1
    For me, using Xcode 7.2.1 with `startMonitoringSignificantLocationChanges` using the Freeway Drive mode on simulator it worked great to `trigger didUpdateLocations:` did not even take 5 minutes for me, started working right away. Thank you Ryan H. – naomimichiko Mar 02 '16 at 20:12
11

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.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • I am able to test significant location change on the simulator correctly with 'Free driveway' option but I am not able to test on the device. Any ideas how this can be tested? – hariszaman May 29 '17 at 13:41