Last active
August 29, 2015 14:22
-
-
Save ydn/efa74a1e29c2cae17fcc to your computer and use it in GitHub Desktop.
Flurry native ads swift example (complete)
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
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)"); | |
} | |
} |
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
Do you get warning/errors about the implied
self
whenevernativeAd
is referenced?