Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My understanding is as follows (I'm in the process of writing an application that relies on this API, but haven't completed this component enough to start testing):</p> <ol> <li>Your application is run for the first time, you register to <strong>startMonitoringSignificantLocationChanges</strong>, and provide a callback function. While your application is running, it will call that callback whenever it receives a significant change.</li> <li>If your application is put to the background, UIApplication will receive <strong>applicationWillResignActive</strong>, followed by <strong>applicationDidEnterBackground</strong>.</li> <li>If your application is killed while it is suspended in the background, you will not be notified; however, if your application is killed while it is running (foreground or background to my knowledge), you will get a moment with <strong>applicationWillTerminate</strong>. You cannot request extra background time from this function.</li> <li><p>Despite being killed in the background, the OS will relaunch your application. If your application is simply launched by the OS for a change, you will get a call to <strong>application didFinishLaunchingWithOptions</strong>:</p> <pre><code>if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey]) </code></pre> <p>will help you determine if you've come back from a background location change.</p></li> <li>If, instead, you were currently running in the background, and your app is manually relaunched by the user, you will receive an <strong>applicationWillEnterForeground</strong> followed by <strong>applicationDidBecomeActive</strong>.</li> <li><s>Regardless of how it happened, when your application is relaunched (unless it was still running in the background as a result of a background task and said task had started monitoring changes), you need to explicitly tell it to <strong>startMonitoringSignificantLocationChanges</strong> again because the callback is no longer attached after "freeze drying." And yes, you just need to implement code in didUpdateToLocation once you've re-attached a location handler of some kind once coming back from the suspended state.</s></li> </ol> <p>This is what I'm going on with my code development right now. As I mentioned before, I'm not quite ready to test this on a device so I can't tell if I've interpreted everything correctly, so commenters, please feel free to correct me (though I've done substantial reading on the topic).</p> <p>Oh, and if by some stroke of bad luck, you release an app that does what I want mine to do, I might cry :)</p> <p>Good luck!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload