Skip to content

Instantly share code, notes, and snippets.

@ydn
Last active August 29, 2015 14:22
Show Gist options
  • Save ydn/efa74a1e29c2cae17fcc to your computer and use it in GitHub Desktop.
Save ydn/efa74a1e29c2cae17fcc to your computer and use it in GitHub Desktop.
Flurry native ads swift example (complete)
class ViewController: UIViewController, FlurryAdNativeDelegate {
let nativeAd = FlurryAdNative(space:"ADSPACE");
override func viewDidLoad() {
super.viewDidLoad();
// Assign the FlurryAdNativeDelegate
nativeAd.adDelegate = self;
// UIViewController used for presentation of the full screen after the user clicks on the ad
nativeAd.viewControllerForPresentation = self;
// Request the ad from Flurry
nativeAd.fetchAd();
}
func adNativeDidFetchAd(nativeAd: FlurryAdNative!){
NSLog("Native Ad for Space \(nativeAd.space) Received Ad with \(nativeAd.assetList.count) assets");
}
func adNative(nativeAd: FlurryAdNative!, adError: FlurryAdError, errorDescription: NSError!) {
//FLURRY_AD_ERROR_DID_FAIL_TO_RENDER = 0,
//FLURRY_AD_ERROR_DID_FAIL_TO_FETCH_AD = 1,
//FLURRY_AD_ERROR_CLICK_ACTION_FAILED = 2,
NSLog("Native Ad for Space \(nativeAd.space) Received Error \(adError), with description: \(errorDescription)");
}
}
@dbgrandi
Copy link

Do you get warning/errors about the implied self whenever nativeAd is referenced?

@DrkSephy
Copy link

No errors or warnings at all. There was an error with declaring nativeAd.Delegate = self, I updated this to be nativeAd.adDelegate = self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment