Last active
December 19, 2015 06:49
-
-
Save pjlaird/5913782 to your computer and use it in GitHub Desktop.
Tap For Tap MoPub iOS Custom Events
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 "MPInterstitialCustomEvent.h" | |
| #import "TapForTapInterstitial.h" | |
| @interface TapForTapInterstitialMoPubCustomEvent : MPInterstitialCustomEvent <TapForTapInterstitialDelegate> | |
| @end |
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 "TapForTapInterstitialMoPubCustomEvent.h" | |
| #import "TapForTap.h" | |
| #import "TapForTapInterstitial.h" | |
| @implementation TapForTapInterstitialMoPubCustomEvent | |
| - (id) init { | |
| self = [super init]; | |
| if (self) { | |
| [TapForTap initializeWithAPIKey:@"YOUR API KEY"]; | |
| [TapForTapInterstitial prepareWithDelegate:self]; | |
| } | |
| return self; | |
| } | |
| - (void) dealloc { | |
| [TapForTapInterstitial setDelegate:nil]; | |
| [super dealloc]; | |
| } | |
| - (void)requestInterstitialWithCustomEventInfo:(NSDictionary *)info | |
| { | |
| [TapForTapInterstitial prepareWithDelegate: self]; | |
| // If Tap for Tap already has an interstitial ready let MoPub know | |
| if ([TapForTapInterstitial isReady]) { | |
| [self.delegate interstitialCustomEvent:self didLoadAd:self]; | |
| } | |
| CLLocation *location = self.delegate.location; | |
| if (location) { | |
| [TapForTap setLocation:location]; | |
| } | |
| } | |
| - (void)showInterstitialFromRootViewController:(UIViewController *)rootViewController | |
| { | |
| [TapForTapInterstitial showWithRootViewController:rootViewController]; | |
| } | |
| - (void) tapForTapInterstitialDidReceiveAd { | |
| [self.delegate interstitialCustomEvent:self didLoadAd:self]; | |
| } | |
| - (void) tapForTapInterstitialFailedToDownload:(NSString *)reason { | |
| [self.delegate interstitialCustomEvent:self didFailToLoadAdWithError:nil]; | |
| } | |
| - (void) tapForTapInterstitialDidShow { | |
| [self.delegate interstitialCustomEventDidAppear:self]; | |
| } | |
| - (void) tapForTapInterstitialWasDismissed { | |
| [self.delegate interstitialCustomEventDidDisappear:self]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment