1. When an application is about to go into an inactive state, during which time the application does not accept messages or events, such as incoming calls
-(void) Applicationwillresignactive: (uiapplication *) application
{
NSLog (@ "Application is going to be inactive, coming into the background");
}
2. The application is running in the background
-(void) Applicationdidenterbackground: (uiapplication *) application
{
NSLog (@ "If the application supports background running, the application is already running in the background"); If you need to exit the background, add it here: Exit (0);
}
3. The application will go into active state execution
-(void) Applicationwillenterforeground: (uiapplication *) application
{
NSLog (@ "Application will enter the active state, will enter the foreground running");
}
4. The application has entered the active state
-(void) Applicationdidbecomeactive: (uiapplication *) application
{
NSLog (@ "application has entered the foreground, is active");
}
5. The application is going to exit, typically for saving data and some cleanup before exiting
-(void) Applicationwillterminate: (uiapplication *) application
{
NSLog (@ "application will exit, usually used to save data and some cleanup work before exiting");
}
6. When the device allocates too much memory to the application, the operating system terminates the application and executes this method before it is terminated, usually where the memory cleanup is done to prevent the program from being terminated
-(void) applicationdidreceivememorywarning: (uiapplication *) application
{
NSLog (@ "system memory is low, need to clean up");
}
7. Execute when the system time has changed
-(void) Applicationsignificanttimechange: (uiapplication *) application
{
NSLog (@ "Execute when system time changes");
}
8. When you push a message, get the Tokenid of the device
-(void) Application: (UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken
{
NSLog (@ "%@", Devicetoken);
}
9.tokenid acquisition failure, do the corresponding processing
-(void) Application: (UIApplication *) app Didfailtoregisterforremotenotificationswitherror: (Nserror *) error
{
NSLog (@ "fail to register for remotenotifications:%@", [err description]);
}
10. Receive Push message processing
-(void) Application: (UIApplication *) application didreceiveremotenotification: (Nsdictionary *) UserInfo {
Set the tag number on the icon to 0;
Application.applicationiconbadgenumber = 0;
NSLog (@ "%@", userInfo);
}
11. When the program is loaded and executed
-(void) applicationdidfinishlaunching: (uiapplication *) application
{
NSLog (@ "Execute when program is loaded");
}
IOS Appdelegate Method Full Solution