How to access applicationDidEnterBackground from viewController
appdelegate, ios
Solution
You are not supposed to call that function from anywhere. It is there to let you know when the app enters the background.
Do you simply want to know when the app enters the background? If so, then you can create a notification to help you with that:
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(handleEnteredBackground:)
name: UIApplicationDidEnterBackgroundNotification
object: nil];
Problem
How can I call `applicationDidEnterBackground` that in `AppDelegate` from a `viewController`? I want to run a function in the background of the app without pressing home button.