-4

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?

1 Answers1

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