My application supports background location updates (especially with significant location monitoring).
Do I need to prevent the user interface from loading (via controllers, etc.) when I determine that the application is in the background ( application.applicationState == UIApplicationStateBackground
)?
My intention is to avoid heavy loading of the user interface (this is a BIG application) in the background, which could result in the loss of all the limited time that I have in the background to actually respond to location updates.
For example (in ObjC, but the question is also for Swift), let's say I have some RootViewController
that initializes and holds the entire hierarchy of controllers / views if I'm in viewDidLoad
do:
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { // Root view controller loaded while in background, so doing only background stuff [self justDoBackgroundStuffWithoutUI]; } else { // Root view controller loaded normally, so loading normal UI [self initializeUIAndChildControllers]; }
? Or should I just βtrustβ iOS to ignore all these UI tasks because it will know this in the background?
source share