Last active
August 29, 2015 14:10
-
-
Save flurrydev/d51dbdcd50341cce8b75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import "FlurryAdInterstitial.h" | |
| #import "FlurryAdInterstitialDelegate.h" | |
| @interface TakeoverViewController () <FlurryAdInterstitialDelegate> | |
| @property (nonatomic, strong) FlurryAdInterstitial* adInterstitial; | |
| @end | |
| @implementation TakeoverViewController | |
| /** | |
| * You can integrate interstitials in any placement in your app, but for | |
| * testing purposes we present integration within your ViewController | |
| */ | |
| @synthesize adInterstitial; | |
| // the adSpaceName refers to the ad space configured on dev.flurry.com under Publishers tab | |
| // under left-hand nav Inventory / Ad Spaces | |
| NSString *adSpaceName = @"FLURRY_INTERSTITIAL_AD"; | |
| - (void)viewDidAppear:(BOOL)animated | |
| { | |
| [super viewDidAppear:animated]; | |
| // Fetch fullscreen ads early when a later display is likely. For | |
| // example, at the beginning of a level. | |
| adInterstitial = [[FlurryAdInterstitial alloc] initWithSpace:adSpaceName]; | |
| adInterstitial.adDelegate = self; | |
| [adInterstitial fetchAd]; | |
| } | |
| -(void) viewDidDisappear:(BOOL)animated | |
| { | |
| [super viewDidDisappear:animated]; | |
| // Do not set ad delegate to nil and | |
| // Do not remove ad in the viewWillDisappear or viewDidDisappear method | |
| } | |
| /** | |
| * Invoke a takeover at a natural pause in your app. For example, when a | |
| * level is completed, an article is read or a button is pressed. We will | |
| * mock the display of a takeover when a button is pressed. | |
| */ | |
| -(IBAction) showFullScreenAdClickedButton:(id)sender | |
| { | |
| // Check if ad is ready. If so, display the ad | |
| if ([adInterstitial ready]) { | |
| [adInterstitial presentWithViewController:self]; | |
| } else { | |
| [adInterstitial fetchAd]; | |
| } | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment