Is there any way to get application insatllation time in iPhone? I wanted to use this information as a unique identifier, can I use it for this purpose?
4 Answers
There is no way to get the application installation time.. You can keep track of the first launch of your application within your application using NSUserDefault.
In application didFinishLaunchingWithOptions: you could do
NSDate *date =[[NSUserDefaults standardUserDefaults]objectForKey:@"FirstLaunchTime"];
if (date == nil) {
// nil means your application running for the first time
[[NSUserDefaults standardUserDefaults]setObject:[NSDate date] forKey:@"FirstLaunchTime"]; // set the current time
}

- 42,757
- 9
- 93
- 110
NO. You don't know anything about the actual installation (duration / time) within your app. You only know the first start date.
For unique IDs, check this answer:
How to get the UDID in iOS 6 and iOS 7

- 1
- 1

- 9,955
- 2
- 28
- 48
-
There is restriction on using UDID by apple na, we can not use it and I have provide support for my app from iOS 4.3, so I guess I cann't use UUID also. Thinking about MAC adress as an alternative. – Dee May 23 '13 at 09:35
-
That's why I posted a link showing alternatives... only the `uniqueIdentifier` call is deprecated. – calimarkus May 23 '13 at 09:39
You can have a field in user setting for this and when user installs and opens it you will get a callback in appDelegate's didFinishLaunching method.
Here you can check if the particular field is nil then only store current date time. You can use this date time in your app.

- 1,043
- 1
- 10
- 32
What you could do is check the /Documents directory to see if there's anything it when it is first run (there shouldn't be if it's the first time it's been installed on that device). If not, write a file there with the current time stamp.
I guess you could use this information as a unique identifier, but in theory, there could be multiple people who open the app for the first time, at the same time. I wouldn't do it.

- 3
- 1