Apologies for the confusing terminology. By "active" I meant to say non-suspended in the background.
So, when you app is in suspended or terminated mode, and the user interacts with the notification, your app is given background execution time for a limited time. You can start a location request then, and it will run as long as your app is still executing within that time. But your app won't be given additional time to wait for the results of the location service.
requestLocation has a time limit. If it can't obtain the location in a timely manner, it will error out and will call the didFailWithError method instead.
If you implement this method, you can check the error and see what is causing the problem.
If requestLocation is only working part of the time, especially after a while, I can think of a couple things:
- the location hardware may have been powered down and it takes longer than the allowed time to get a fresh fix, depending on your environment at the time
- if you suspect that it is not working after your app has been terminated, please make sure you are re-instantiating your location manager and other related objects, as your previous memory objects have all been destroyed by then.