user3355723
user3355723

Reputation: 235

How to stop pop-ups during an in-app purchase

On our free app, when calling a function to remove ads, or buy extra content, the user tends to get bugged by an extra popup from an advertisement call that really should only ever appear once when the app is started and never again (until app is closed of course) Usually we set the ad popup in the applicationDidBecomeActive part of the code in the appdelegate.m file which checks if the user has purchased remove ads, and if not, displays an ad.

If I call the ads in the viewDidLoad of a viewcontroller it does not happen, however, the downside to this, is when the user returns to the main menu of the app, they are again hit with a pop-up ad every time, so both have their problems, the latter essentially worse.

Is there a better place to call the popup ad, that will trigger on launch but NOT on every time the user returns to the main screen OR makes a purchase using MKStoreManager.

I can post code, but at this moment I am not sure which part would be relevant.

Upvotes: 1

Views: 422

Answers (1)

Chris Prince
Chris Prince

Reputation: 7574

Why not have a BOOL variable as an instance variable, or even a static, in the app delegate that gets set to YES once you have displayed your popup, and then checks this variable so as to not display it again in that session?

- (void)applicationDidBecomeActive:(UIApplication *)application {
   static BOOL adShown = NO;

   if (! adShown) {
      // your code to show ad
      adShown = YES;
   }
}

Upvotes: 2

Related Questions