Search code examples
iosobjective-cactionexithome-button

Do action upon exit of ios app


How can I assign actions on iOS when a user presses the home button (exit)? I want this for an app where uses user a login feature and I want, upon exit, the user to log out. I dont want to use a button for this.


Solution

  • Use the method,

    - (void)applicationDidEnterBackground:(UIApplication *)application
    

    In your application's delegate.