Jacob White
Jacob White

Reputation: 355

Is it possible to only show iAds on first launch

I have a free app that I suspect is only launched by the majority of its users a couple times before its deleted. Is it possible to only show an iAd banner on the first launch of the application, or maybe only implement iAd until after the first ad is filled?

Upvotes: 1

Views: 128

Answers (1)

Daniel Storm
Daniel Storm

Reputation: 18878

Use NSUserDefaults to store a value that you can check and see if the application has been launched before.

-(void)viewDidLoad {
    // Show iAd on first run
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if (![defaults boolForKey:@"notFirstRun"]) {

        // iAd code here

        // Update NSUserDefaults
        [defaults setBool:YES forKey:@"notFirstRun"];
    }
}

I can't imagine a scenario where you would want to limit your ad revenue to just the initial run though.

Upvotes: 1

Related Questions