So your question is basically āHow can I get around Appleās specially designed user experience for people who want to close my application?ā The answer to this question is: "No, if you want to stay within the rules for the AppStore."
Listen, if the user decides to terminate your application (i.e. they scroll up and exit the task manager), this whole goal is for your application to stop something . Apple designed this so that people can quickly turn off exactly the behavior that you seem to want to implement. I donāt quite understand why you would like to get around this. I agree that this interaction is a bit unclear (in the end, users can also allow / deny the applicationās right to receive location updates in the background in the Settings application), but this determines the iOS interaction.
If I understand you correctly, you were able to correctly configure the background location modes so that your application can receive location updates, even if it is not in the foreground (that is, in the background or paused, in the latter situation, iOS will wake it so you can process updates locations and, for example, send a local notification to inform the user). This is as good as it gets.
Oh, and don't be afraid to reboot the device. Yes, after the reboot, your application does not technically work, but since the last time the user clearly did not kill him, iOS treats him as if he was in suspend mode, IIRC, so you will still receive significant location updates and will be able to respond normally, ( More generally, people often seem to think that the actual state of the application process reflects the state of the application, as defined in the documentation, and / or that the application is shown in the task manager, is related to this. ).
Edit after your comment asked me a question about choosing a background:
Sorry, perhaps this was not entirely clear. I specifically did not answer this question, because after the user intentionally dismissed your application, you should not, as explained, ādeceiveā your intention. Because of this, silent push notifications will not work.
I donāt know if the background selection will be reset in the same way (maybe, but I havenāt tried it), but I think this will not help you either, even if it still works (which I doubt Apple will probably be difficult on this occasion). I also never tried (re) triggering location updates in this method, so I canāt say if it even works (as soon as the completion handler is called the system, it will most likely pause your application, at least, and I'm not sure if this "resets" the user killed the application flag, which the system apparently uses to determine which application wakes up and delivers location updates).
application:performFetchWithCompletionHandler: (since it is fully called) the heuristic-based OS will be called, it tries to be smart on this. Since this method is designed to retrieve some data from the backend that does not provide push notifications, the times it calls at all can be very limited, as explained in the documentation . The actual mechanism that decides when the OS call is a black box and it is a gamble to try to trick it when called when you need it. It can be very likely that this will happen in a few hours. Think of the following scenario:
- Your application works fine in background location modes (did I understand correctly that you installed it successfully? See here and here )
- The user manually kills your application. For the sake of this argument, suppose that the system does not restart the system later to allow it to fetch background
- Since other applications are running on the system, and at the moment the user has only a boundary connection, the OS decides that this is a bad time to initiate background sampling (I just assume that these factors play a role, since it is a black box, but to me it seems reasonable). Your user walks around a few more, bypassing several places that interest you.
- After two hours, the user is already in a completely different area, your application starts the OS again and receives a call to
application:performFetchWithCompletionHandler: You run location updates again (suppose it even works, and the system does not immediately terminate the application again, that is, even after fake background extraction ensures that the location is updated in the background). You have missed several locations, but, nevertheless, the application now processes new ones. All your logic is mostly confused because you did not plan to have so many missing location updates ... - (Optional: after a while, your user understands that your application seems to be doing something, even though it has stopped it (for example, they notice a battery leak). They will delete your application and leave a one-time review. ..)
- (Optional 2, the worst case scenario: as soon as the apple realizes that after updating the userās application, itās possible to reinitialize the background updates, they just close the loop in the iOS update and your application returns there we started ...)
For the record: I donāt advocate any design decisions made by an apple, damn it, I know that it is confusing to wrap my head and how can I take the position of āsave battery and user intention under any circumstancesā do one for better background tracking. I simply point out that they are in control here and trying to fondle around any specific interaction paradigms that they establish on the platform, probably not a good idea.
That says it all, I'm afraid that "the user has stopped the application, now I do not receive any location updates" - this is just what you need to live with. Why would this be a problem for you if you didn't say anything about the background location modes you were missing? The only (dubious) scenario that I could imagine was a kind of tracker application, possibly given on devices handed out to delivery service employees or something like that. If this is so (and put aside ethics for such things, in some countries that are even illegal, mind you ...), I must say that iOS is simply not the right platform for this.