IOS Appdelegate Method Full Solution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.