Last active
December 17, 2015 23:29
-
-
Save Bisera/5689447 to your computer and use it in GitHub Desktop.
This file contains 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 "FlurryAdDelegate.h" | |
#import "FlurryAds.h" | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
// Register yourself as a delegate for ad callbacks | |
[FlurryAds setAdDelegate:self]; | |
// Fetch fullscreen ads early when a later display is likely. For | |
// example, at the beginning of a level. | |
[FlurryAds fetchAdForSpace:@”INTERSTITIAL_MAIN_VIEW” | |
frame:self.view.frame size:FULLSCREEN]; | |
} | |
-(void) viewWillDisappear:(BOOL)animated { | |
[super viewWillDisappear:animated]; | |
// Reset delegate | |
[FlurryAds setAdDelegate:nil]; | |
} | |
/** | |
* 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 ([FlurryAds adReadyForSpace:@"INTERSTITIAL_MAIN_VIEW"]) { | |
[FlurryAds displayAdForSpace:@"INTERSTITIAL_MAIN_VIEW" | |
onView:self.view]; | |
} else { | |
// Fetch an ad | |
[FlurryAds fetchAdForSpace:@"INTERSTITIAL_MAIN_VIEW" | |
frame:self.view.frame size:FULLSCREEN]; | |
} | |
} | |
/* | |
* It is recommended to pause app activities when an interstitial is shown. | |
* Listen to should display delegate. | |
*/ | |
- (BOOL) spaceShouldDisplay:(NSString*)adSpace interstitial:(BOOL) | |
interstitial { | |
if (interstitial) { | |
// Pause app state here | |
} | |
// Continue ad display | |
return YES; | |
} | |
/* | |
* Resume app state when the interstitial is dismissed. | |
*/ | |
- (void)spaceDidDismiss:(NSString *)adSpace interstitial:(BOOL)interstitial { | |
if (interstitial) { | |
// Resume app state here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment