ADFAdView Class
This is the main class and it extends UIView. This Class is responsible for gathering all the needed information to get an ad from AdFalcon network and rendering it on the device.
The properties of the ADFADView Class are:
Property | Description |
int refreshDuration | Refresh duration in seconds |
NSObject * delegate | Delegate of AdFalcon view |
BOOL testing | The property is used to inform AdFalcon network that the application is under the testing mode rather than production mode. |
BOOL logging | Enable logging |
ADFTargetingParams targetingParams | This property is used to hold the extra information about the current user of App. |
The methods of the ADFADView Class are:
Method | Description |
-(void) initializeWith
AdUnit:(ADFAdViewAdUnitSize) adUnit siteId: (NSString*) siteId userInfo: (ADFUserInfo*) userInfo rootViewController: (UIViewController*) rootViewController enableAutorefresh: (BOOL) enableAutorefresh delegate: (NSObject *) delegate |
Will initialize the AdFalcon view and load the ad.
All the parameters are required except “delegate” which can be null. |
-(void) pauseAutoRefresh; | Will pause auto refresh timer which is responsible for getting new ad the ad after a certain period has elapsed. |
-(void) resumeAutoRefresh | Will resume the auto refresh timer which responsible for getting new ad after a certain period has elapsed. |
-(void) refreshAd | Will get a new ad from AdFalcon. |
ADFAdViewDelegate Protocol
AdFalcon SDK provides a protocol called ADFAdViewDelegate that is responsibles for providing feedback from AdFalcon SDK. This protocol contains nine optional delegate methods which are called upon the following events:
- When an error occurs
- Before and After an ad is loaded
- Before and After ad click action screen is displayed
- Before and After ad click action screen is closed
- Application will go to background mode and
- Application will terminate.
The methods of the ADFADViewDelegate Class are:
Method | Description |
-(void)adViewWillLoadAd:(ADFAdView*) adView; | Will be called before the ad is being loaded. |
-(void)adViewDidLoadAd: (ADFAdView*) adView; | Will be called after the ad has been loaded |
-(void)adView: (ADFAdView*) adView didFailWithCode:(int) code message:(NSString*) message; | Will be called when an error has occured during loading an ad. |
-(void)adViewWillPresentScreen: (ADFAdView*) adView; | Will be called before the ad click screen is displayed. |
-(void)adViewDidPresentScreen: (ADFAdView*) adView; | Will be called after the ad click screen is displayed. |
-(void)adViewWillDismissScreen: (ADFAdView*) adView; | Will be called before the ad click screen is dismissed. |
-(void)adViewDidDismissScreen: (ADFAdView*) adView; | Will be called after the ad click screen is dismissed. |
-(void)applicationWillTerminate:(UIApplication *)application; | Will be called before the Application is terminated. |
-(void)applicationWillEnterBackground:(UIApplication *)application; | Will be called before the Application enters into background mode. |
ADFInterstitialAd Class
This Class is responsible for gathering all the needed information to get an interstitial ad from AdFalcon network and presenting it on the device.
The properties of the ADFInterstital Class are:
Property | Description |
NSObject * delegate | This property is required. It is used to pass a reference to the class implementing AdFalcon interstitial delegate. |
NSString * siteId | This property is required. Represents the Id of App. |
BOOL testing | The property is used to inform AdFalcon network that the application is under the testing mode rather than production mode. Before releasing your application ensure this is set to false. |
BOOL isReadyToPresent | The value is true when the ad is loaded successfully and ready to be presented otherwise will be false. |
ADFTargetingParams * targetingParams | This property is used to hold the extra information about the current user of App. |
BOOL logging | Enable logging |
The methods of the ADFADView Class are:
Method | Description |
-(void) loadInterstitial; | Used to load new interstitial Ad but before using this method you must fill the required properties. |
-(void) loadInterstitialWithSiteID:(NSString*) siteID delegate:(NSObject *) delegate; | Used to load new interstitial Ad with required parameters. |
-(void) loadInterstitialWithSiteID:(NSString*) siteID testing:(BOOL) testing delegate:(NSObject *) delegate params:(ADFTargetingParams*) params; | Used to load new interstitial Ad with all possible parameters including additional user information. |
-(void) presentFromRootViewController:(UIViewController*) rootViewController; | Used to present the loaded interstitial from specified root view controller.
You should not call this method before the interstitial is loaded successfully. So we recommended to call this method when The Interstitial fires adfInterstitialDidLoadAd delegate’s method. |
ADFInterstitialAdDelegate Protocol
AdFalcon SDK provides a protocol called ADFInterstitialAdDelegate that is responsible for providing feedback from interstitial view. This protocol contains delegate methods which are called upon the following events:
- When an error occurs
- Before and After an ad is loaded
- Before and After interstitial is displayed
- Application will go to background mode and will be terminated.
The methods of the ADFADViewDelegate Class are:
Method | Description |
-(void)adfInterstitialDidLoadAd: (ADFInterstitialAd*) adfInterstitial; | Required delegate method and will be called after the ad has been loaded. |
-(void)adfInterstitialDidDismissScreen: (ADFInterstitialAd*) adfInterstitial; | Required delegate method and will be called after the interstitial screen has been dismissed. |
-(void)adfInterstitial: (ADFInterstitialAd*) adfInterstitial didFailWithErrorCode:(int) code message:(NSString*)message; | Required delegate method and will be called when an error has occured during loading an ad. |
-(void)adfInterstitialWillPresentScreen: (ADFInterstitialAd*) adfInterstitial; | Optional. Will be called before the interstitial screen is presented. |
-(void)adfInterstitialWillDismissScreen: (ADFInterstitialAd*) adfInterstitial; | Optional. Will be called before the interstitial screen is dismissed. |
-(void)adfInterstitialAppWillTerminate:(ADFInterstitialAd*) adfInterstitial; | Optional. Will be called before the Application is terminated. |
-(void)adfInterstitialAppWillEnterBackground:(ADFInterstitialAd*) adfInterstitial; | Optional. Will be called before the Application enters into background mode. |
ADFUserInfo Class
The ADFUserInfo Class contains all the needed parameters about the user of application.
The parameters of the ADFUserInfo Class are:
Parameter | Required | Description | Values |
Language | No | The language of the requested ad in ISO 639-1 language codes format (Two Letters code); | ar, en |
Postal code | No | A parameter containing the user’s postal/ZIP code
|
11121 |
Area code | No | A parameter containing the user’s area code | 06 |
Age | No | A parameter containing the user’s age | 27 |
Gender | No | A parameter containing the user’s gender | kADFUserInfoGenderNone kADFUserInfoGenderMale kADFUserInfoGenderFemale |
Country code | No | County code of the end user in ISO 3166-1 alpha-2 format code (two-letter code)
|
JO, SA …etc. |
Birthdate | No | Birthdate of application user in format dd.MM.yyyy | 21.11.1984 |
Location: Latitude, Longitude | No | The geolocation information of the device. The location information is divided into two double values; latitude and longitude.
|
35.658, 34.641 |
ADFTargetingParams Class
The ADFTargetingParams Class contains all the needed parameters about any given user and application in order to help adFalcon network to send most related and targeted ads to the user and application. All parameters are optional.
The parameters of the ADFTargetingParams Class are:
Parameter | Required | Description | Values |
userInfo | No | A class containing information about the user of application | ADFUserInfo |
Keywords | No | A list conataining keywords in comma separated format. AdFalcon’s ads selector engine will search for ads containing these keywords. | ex. sport, news, lifestyle, …etc. |
Additional Info | No | A map of keys and values to add additional parameters. |
ADFAdViewAdUnitSize Enum
ADSAdViewAdUnitSize Enum defines the ad units supported by the AdFalcon iOS SDK
Enum | Description | Size | Devices |
kADFAdViewAdUnitSizeAutoBanner | The server will return the best banner ad based on the screen size and device type | All | |
kADFAdViewAdUnitSize320x50 | Standard | 320 x 50 | All |
kADFAdViewAdUnitSize300x250 | Medium Rectangle | 300 x 250 | All |
kADFAdViewAdUnitSize468x60 | Full Banner | 468 x 60 | Tablet |
kADFAdViewAdUnitSize728x90 | Leaderboard | 728 x 90 | Tablet |
kADFAdViewAdUnitSize120x600 | Skyscraper | 120 x 600 | Tablet |
ADFAdViewError Enum
Enum | Description |
kADFAdViewErrorInternalServer | is an error that’s happened within the web server attempting to get you an ad. It’s typically a server-side problem out of your control
|
kADFAdViewErrorNoAdAvailabe | no ad available in AdFalcon stores |
kADFAdViewErrorInvalidParam | There is a parameter has invalid value |
kADFAdViewErrorMissingParam | You have missed to fill required parameter |
kADFAdViewErrorGenericSDK | An error happened within the SDK during attempting to load or render an ad. |
kADFAdViewErrorCommunication | No connection available to the internet. |
kADFAdViewErrorInterstitialAlreadyUsed | An error happened when application try to reuse Interstitial |