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