The "applicationWillTerminate" method will only be called when the application is not in a suspended state at completion.
To understand this, given that your application is currently in an active foreground state, do the following two cases:
Case 1: When the button is a single Home button , the application directly goes into a suspended state by calling methods - (1) applicationWillResignActive, and then (2) applicationDidEnterBackground.
Now, when you try to close / close the application by double-clicking the home button, and then expanding the current application screen from the last application screens, the application is in a suspended state. Thus, the applicationWillTerminate method will not be called.
Case 2: When you double-click the Home button, the application goes into an inactive state by calling the method - (1) applicationWillResignActive.
Now, when you try to close / close the application by canceling the current application screen on the last application screens, the application is in an inactive state (not in a suspended state) when it is completed. Thus, the applicationWillTerminate method will be called .
See what Apple says: 
For more information about this image - Apple Official Documentation at applicationWillTerminate (_ :)
source share