How Can I capture the event before my App is minimized?

cocoa-touch, ios, iphone, objective-c, xcode

Solution

Use the delegate method `- (void)applicationDidEnterBackground:(UIApplication *)application` which is in appdelegate class. Whenever user taps the home button, this method will be called. for more details, check apple documentation. You can use `applicationWillResignActive:` in case you want to detect an incoming phone call or sms as well along with app minimizing.

Problem

I need to close some resources I am using when the App is minimized by clicking on Home Button. Attention, I don't want to intercept the Home button, I know it is not allowed by Apple thanks

Original source