IOS Tips Summary

Source: Internet
Author: User

1. Get the exact time it takes for the app to start

The application startup time is very important for the first experience of the user, and the system has strict requirements on the running time of the application, such as startup and recovery, and the system shuts down the application directly when the application time-out occurs.
Here are a few common scenarios in which the system requires app uptime:

Launch 20 seconds resume 10 seconds suspend 10 seconds quit 6 seconds background Task 10 minutes

1) Add in the point main.m file

Cfabsolutetime starttime;//start time int main (int argc, char * argv[]) {    @autoreleasepool {         starttime= Cfabsolutetimegetcurrent ();//Start Time        return Uiapplicationmain (argc, argv, Nil, nsstringfromclass ([appdelegate Class]));}    }

2) Add the APPDELEGATE.M file

@interface appdelegate ()/** *  declares StartTime, which is used to invoke the StartTime global variable in MAIN.M in this class. */extern Cfabsolutetime StartTime;
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {    Self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];    Self.window.backgroundColor = [Uicolor whitecolor];    [Self.window makekeyandvisible];         NSLog (@ "program start time%f seconds! ", Cfabsolutetimegetcurrent ()-starttime);//Time difference    return YES;}

IOS Tips Summary

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.