This section describes how to integrate with the AdFalcon’s iOS SDK in order to consume the services available by the network.
in order to integrate with the SDK, please perform the following steps:
Add ADFInterstitialAd to your ViewController header file
- Import the module of AdFalcon SDK “AdFalconSDK”.
- implement ADFInterstitialAdDelegate protocol and declare ADFInterstitialAd instance.
Below is an example of how the header should look like:
@import "AdFalconSDK"; @interface ViewController: UIViewController { ADFInterstitialAd * adfInterstitial; }
Add ADFInterstitialAd to your ViewController implementation
- Add the following code in viewDidLoad method
//initialize ADFInterstitialAd adfInterstitial = [[ADFInterstitialAd alloc] init]; //If you want to receive test ads adView.testing = YES; //load new interstitial [adfInterstitial loadInterstitialWithSiteID:@"Your site ID" delegate:self];
Note: If more information are available about the user, then it is recommended that you call the method below instead and pass the user information in ADFTargetingParams parameter in the same way this is handled in the Standard Banner Ad.
-(void) loadInterstitialWithSiteID:(NSString*) siteID testing:(BOOL) testing delegate:(NSObject *) delegate params:(ADFTargetingParams*) params;
- Add the following required delegate methods for the ADFInterstitialAdDelegate
-(void)adfInterstitialDidLoadAd: (ADFInterstitialAd*) adfInterstitial{ [adfInterstitial presentFromRootViewController:self] } -(void)adfInterstitialDidDismissScreen: (ADFInterstitialAd*) adfInterstitial{ } -(void)adfInterstitial: (ADFInterstitialAd*) adfInterstitial didFailWithErrorCode:(int) code message:(NSString*)message{ switch (code) { case kADFAdViewErrorNoAdAvailabe: // No Ad Availabe break; case kADFAdViewErrorInvalidParam: // Invalid Param send to server break; case kADFAdViewErrorMissingParam: // Missing Param send to server break; case kADFAdViewErrorCommunication: //Communication with server failed or no internet break; default: break; } }