alexrothenberg
alexrothenberg

Reputation: 184

Is there an IOS notification or callback that gets called when an app is installed?

I'd like to do some setup at install time but am not sure if there's an event IOS sends to me when my app is installed.

What I'm trying to do is download some seed data so that when the user first launches my app for the first time it wont be empty. I guessed there might be something in UIApplication but I couldn't find anything.

Thanks for any help.

Upvotes: 2

Views: 3108

Answers (1)

Phillip
Phillip

Reputation: 4306

If you want to do some sort of setup at, and only at first launch, then just use NSUserDefaults!

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];  
    if (![defaults objectForKey:@"firstLaunch"]){
        [self performSelector:@selector(yourSetupView) withObject:nil afterDelay:0.5];
        [defaults setObject:[NSDate date] forKey:@"firstLaunch"];

    }          

    [[NSUserDefaults standardUserDefaults] synchronize];

In this case, when the user runs the app for the very first time, yourSetupView appears after a very very small delay.

Upvotes: 10

Related Questions