After the project is created, the following methods are provided by default in the Appdelegate class, with the following features:
1, the application executes the first time it is runThis method is only executed once when the app is first run and will not be executed every time the app is activated from the background. (Note: All generally we are here to obtain user licenses, such as local message push licensing, etc.)
| 1234 |
func application (application: uiapplication didfinishlaunchingwithoptions launchoptions: [ : anyobject ) bool {      return true |
2, execution when application hangs
The application hangs when a call comes in or locks the screen.
| 1 |
funcapplicationWillResignActive(application: UIApplication) |
3, the application executes when it enters the background
| 1 |
funcapplicationDidEnterBackground(application: UIApplication) |
4, the application will go back to the foreground when the execution
| 1 |
funcapplicationWillEnterForeground(application: UIApplication) |
5, the application executes when it re-enters the active state
| 1 |
funcapplicationDidBecomeActive(application: UIApplication) |
6, the application will be executed when exiting
This is usually used to save data and do some cleanup before exiting. Refer to my other article, "Swift-the program goes backstage, and the method that is called when the application terminates"
| 1 |
funcapplicationWillTerminate(application: UIApplication) |
Introduction to Default methods in the Swift-appdelegate.swift class