I am using beginBackgroundTaskWithExpirationHandler
at many places in my app whenever it's necessary to complete a task and I do endBackgroundTask
when the task is over.
There are some crucial parts of my code where i want to know whether the app currently can suspend (if backgrounded).
So, whenver I do endBackgroundTask
, I want to check whether any UIBackgroundTaskIdentifier
in the entire app is not UIBackgroundTaskInvalid
so that I can notify all the the crucial parts that the app is no longer protected by any beginBackgroundTaskWithExpirationHandler
and is supendable.
Is there any property of [UIApplication sharedApplication]
which will store these values? Or any other way to know that?