Answer the question
In order to leave comments, you need to log in
What is the essence of Background Modes in IOS?
There is an application that checks the user's location in real time. In xCode, on the Capabillities tab, Background Modes is enabled as locations update. I sent this miracle to the app store. There it was successfully rejected, indicating that the ability to get the location in the background was enabled, but this function was not found in the application. I'm in a panic - I think how it is, because without this setting, when the application is minimized to the background, the application will not receive coordinates. I decided to check it - turned off the setting, started (emulator) - everything works, everything is processed in the background and with the device locked. So what is the point of setting Background Modes? Is it possible to do without it (the application should receive coordinates within an hour or three after turning on through the application itself, while it will most likely be minimized)?
Answer the question
In order to leave comments, you need to log in
Have you been checking for location updates for a long time in the background?
Any active application, when switching to the background, first goes into
background mode, in which it continues to receive system calls and work, the application is given the operating system to finish its business for some time, and only then it moves to suspended mode, in which it no longer works and gets nothing.
But for applications that have a reason to run in the background, you can set backgorund permissions, and then it will run in the background for as long as necessary.
If you read some guides:
www.raywenderlich.com/29948/backgrounding-for-ios
One thing to note is that they estimate the amount of time a normal, non-background-permissioned app can get in the background at 10 minutes:
"If your app does not need to do any of these things, then you're out of luck… with one exception: all apps get up to 10 minutes to finish whatever they were doing before the app is truly suspended."
before going into suspended mode.
That being said, with regard specifically to location updates:
"Once again, for the sneaks: you can only use this background mode if your app truly needs this information to provide value for the user. If you use this mode and Apple sees nothing the user will gain from it, your app will be rejected Sometimes Apple will also require you to add a warning to your app's description stating that your app will result in increased battery usage."
What Apple requires for applications receiving background-permission is that their "hanging" be expressed in some kind of obvious and useful activity for the user, and not just "silently" collect some statistics. That is, your application should display some useful information to the user, generated by receiving location updates, they won’t let the battery just hang and “eat”.
PS If Wi-Fi accuracy suits you - that is, the option to use the significant-change location service, it can wake up the application every 15 minutes:
https://developer.apple.com/library/ios/documentat...
"If GPS-level accuracy isn't critical for your app and you don't need continuous tracking, you can use the significant-change location service. It's crucial that you use the significant-change location service correctly, because it wakes the system and your app at least every 15 minutes, even if no location changes have occurred, and it runs continuously until you stop it.
...
If you leave the significant-change location service running and your iOS app is subsequently suspended or terminated, the service automatically wakes up your app when new location data arrives. At wake-up time, the app is put into the background and you are given a small amount of time (around 10 seconds) to manually restart location services and process the location data. (You must manually restart location services in the background before any pending location updates can be delivered, as described in Knowing When to Start Location Services.) Because your app is in the background, it must do minimal work and avoid any tasks (such as querying the network) that might prevent it from returning before the allocated time expires. If it does not, your app will be terminated. If an iOS app needs more time to process the location data,
"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question