How to calculate iOS app boot time

前端 未结 2 1265
春和景丽
春和景丽 2021-01-22 11:33

I was wondering if there is a quick and efficient way to determine the Time from opening an app to when it\'s fully loaded.

  • I was thinking I\'d do something like
2条回答
  •  滥情空心
    2021-01-22 11:48

    Keep a NSUserDefaults value to count the run time of the app in your didFinishLaunchingWithOptions or applicationDidBecomeActive method:

    int i = [[NSUserDefaults standardUserDefaults] integerForKey:@"usageCount"];
    i = i+1;
    [[NSUserDefaults standardUserDefaults] setInteger:i forKey:@"usageCount"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    

提交回复
热议问题