Can we get the timestamp when the app icon is tapped to open the app?
No. Again, this’d make a fine enhancement request (you could imagine it being included in the options dictionary passed to
-application:willFinishLaunchingWithOptions:
.
Alternatively, You might be able to get the start time of your process. macOS has a nice way to do this (NSRunningApplication’s
launchDate
property) but that’s not available on iOS. The only alternative that springs to mind is the
p_starttime
value return by
sysctl
(with the MIB
CTL_KERN
>
KERN_PROC
>
KERN_PROC_PID
>
yourPID).
IMPORTANT In recent years the iOS sandbox has increasingly restricted
sysctl
’s access to the process list, so I don’t know if this will currently work.
WARNING If you do end up going down this path, make sure that your app handles failure well. It’s fine to use this suggestion for debugging, testing and analytics, but I’d hate for your app to crash somewhere down the line as
sysctl
gets even more restrictive.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"