How to calculate iOS app boot time

前端 未结 2 1264
春和景丽
春和景丽 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];
    
    0 讨论(0)
  • 2021-01-22 11:52

    That really won't work because it doesn't deal with iOS loading and launching your app.

    The best you should do is log a timestamp in main but again, this won't include the time it takes iOS to load and launch the app to the point that main is called.

    Any timing you do will be from that point forward which may still be useful depending on your goal.

    0 讨论(0)
提交回复
热议问题