When app run didFinishLaunch is called either for the first time or when we kill application and again start it. Is there any method which is called only once or at time of installation only?
Asked
Active
Viewed 716 times
-4
-
Please mention clearly in your question what you want to know. – Rajat Sep 02 '15 at 05:22
1 Answers
1
There is no method which is called only once or at time of installation only.
But you can create this method by using NSUserDefaults. You can add to DidFinishLaunching this code:
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"RunBefore"] == nil)
{
//exec your code
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"RunBefore"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

Andrew Romanov
- 4,774
- 3
- 25
- 40