iOS app launch time measurement

后端 未结 6 1780
醉梦人生
醉梦人生 2021-02-15 17:19

How can I count the time it takes from the moment the user presses the launch button on the home screen until the moment the app is active (for example, until the viewDidAppear

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-15 18:17

    Since you can't get the exact time when the user touches the app's icon on homescreen, I suggest to start your app from another app, so you can get the exact time your app starts.

    • Register a custom URL scheme in your app
    • create a helper-app that can launch your app by a url
    • log the time when the helper app launches your app (or send the timestamp to your app)
    • in your app log the time when launch is done at a appropriate place (AppDelegate or the main ViewController)
    • if you have sent the timestamp of the launch from the helper app, you can calculate the difference programmatically, otherwise just compare both times in the console

提交回复
热议问题