0

According to Apple's docs, if I run startMonitoringSignificantLocationChanges and then terminate my app the significant location changes API will re-launch my app when a significant location event happens (move 500+ meters).

How can I tell that this location event is being fired? How can I tell if my app has been re-launched to handle the event?

So far, the only way I've found to test this is by sending local push notifications when the event is received, but since push notifications don't work on the simulator, and I can't use the XCode debug locations when my app is terminated, I had to take the phone outside and walk a mile or so (and even then the single notification only appeared when I got back to my desk after the walk).

Is there any reasonable way to work with or test these APIs?

This question probably belongs on StackOverflow, but I know it will get closed immediately for not including any code.

1

Just write something to a log file you can keep within the app's data folder. If you add a timestamp, you'll be able to monitor when the app has been woken up.

This will enable you to test using the simulator. The simulator will also allow you to simulate location changes from the top menu.

  • Any idea if I can make a network request instead of writing to a file? I figured it wouldn't matter, but it doesn't appear to be sending any requests. I tested the request code by moving it outside the isLocationLaunch check and it works, but once the app is terminated, no requests are being sent. – SimpleJ Jul 18 '18 at 21:39
  • Start by outputting to the debug console like any ordinary debugging. Then try the file method. Keep things simple. – jksoegaard Jul 18 '18 at 22:45
  • The debug console doesn't show anything that's logged after the app has been woken for a location event. – SimpleJ Jul 18 '18 at 22:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .