0

我在我正在开发的应用程序中使用来自 RevMob 的广告,我想知道如何每 5. 应用程序打开显示一个全屏广告。我不知道怎么做,我在网上也没有找到任何关于这个的东西。感谢您的帮助!

我正在使用的当前代码在 AppDelegate.m 中:

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

[RevMobAds session].parallaxMode = RevMobParallaxModeOff;
        [[RevMobAds session] showFullscreen];
}
4

1 回答 1

2

使用 NSUserDefaults 存储应用程序打开的次数,并在每次- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

然后在它被打开 5 次时做任何你想做的事情:]

前任:

NSInteger timesLaunched = [[NSUserDefaults standardUserDefaults] integerForKey:@"timeslaunched"]
timesLaunched++
[[NSUserDefaults standardUserDefaults] setInteger:timesLaunched forKey:@"timeslaunched];

if (timesLaunched % 5 == 0) {
  // Show Ads
}
于 2014-02-12T16:24:11.747 回答