Skip to content

Instantly share code, notes, and snippets.

#import "Flurry.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Replace YOUR_API_KEY with the api key in the downloaded package
[Flurry startSession:@"YOUR_API_KEY"];
//initialize Flurry ad serving, required to provide ViewController
[FlurryAds initialize:self.window.rootViewController];
// Your code
#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
adBanner = [[FlurryAdBanner alloc] initWithSpace:@"BANNER"];
[adBanner fetchAndDisplayAdInView:self.view viewControllerForPresentation:self];
if ([adInterstitial ready])
{
[adInterstitial presentWithViewControler:self];
}
else
{
adInterstitial = [[FlurryAdInterstitial alloc] initWithSpace:@"INTERSTITIAL"];
[adInterstitial fetchAd];
}
#import "FlurryAdNativeDelegate.h"
@interface SampleTableViewController () <FlurryAdNativeDelegate>
@implementation SampleTableViewController
//For instance, the two most frequently used callbacks are:
- (void) adNativeDidFetchAd:(FlurryAdNative*)nativeAd
{
// The SDK returns this callback for every instance of the native ad fetched.
flurryNativeAd = [[FlurryAdNative alloc] initWithSpace:@"NativeAd"];
flurryNativeAd.adDelegate = self;
flurryNativeAd.viewControllerForPresentation = self;
[flurryNativeAd fetchAd];
flurryNativeAd.trackingView = self;
#import "FlurryAdNative.h"
#import "FlurryAdNativeDelegate.h"
@interface SampleTableViewController () <FlurryAdNativeDelegate>
@property (nonatomic, retain) FlurryAdNative* nativeAd;
@end
@implementation SampleTableViewController
UIView *nativeAdView = [[UIView alloc]initWithFrame:adFrame];

UILabel *headlineLabel = [[UILabel alloc] initWithFrame:headlineFrame];
UILabel *summaryLabel = [[UILabel alloc] initWithFrame:summaryFrame];
UILabel *sourceLabel = [[UILabel alloc] initWithFrame:sourceFrame];
UIImageView *adImageView ;
for (int ix = 0; ix < adNative.assetList.count; ++ix)
{
FlurryAdNativeAsset* asset = [adNative.assetList objectAtIndex:ix];
if ([asset.name isEqualToString:@"headline"])
mFlurryAdBanner = new FlurryAdBanner(this, fContainer, "BANNER");
mFlurryAdBanner.fetchAndDisplayAd();
if (mFlurryAdInterstitial.isReady()) {
mFlurryAdInterstitial.displayAd();
} else {
mFlurryAdInterstitial = new FlurryAdInterstitial(this, "INTERSTITIAL");
mFlurryAdInterstitial.fetchAd();
}