ADFUserInfo Class
The ADFUserInfo Class sets the information of app’s user.
The properties 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 | The user’s postal/ZIP code
|
11121 |
Area code | No | The user’s area code | 06 |
Age | No | The user’s age | 27 |
Gender | No | 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 app 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 sets the user and app information in order to help AdFalcon to deliver the most related and targeted ad to the user. All properties are optional.
The properties of the ADFTargetingParams Class are:
Parameter | Required | Description | Values |
userInfo | No | A class containing information about the user of app | ADFUserInfo |
Keywords | No | A list containing keywords in comma separated format. AdFalcon’s ads selector engine will search for ads relevant these keywords. | ex. sport, news, lifestyle, etc. |
Additional Info | No | A map of keys and values to add additional parameters. |
ADFNativeAd Class
Property | Attribute | Description |
estimatedSize | Read only | Returns expected size based on the passing ad template in initialize method |
status | Read only | Returns enum value of ADFNativeAdStatus type, this is used to know the current status for native ad. The possible values are the following:
· kADFNativeAdStatusNone · kADFNativeAdStatusLoading · kADFNativeAdStatusReady · kADFNativeAdStatusFailed · kADFNativeAdStatusClicked |
ready | Read only | Boolean value, returns yes if the ad is loaded successfully and ready to show. No if the ad is still loading, failed or not loaded yet. |
errorMessage | Read only | String value, this value will be filled, if the status of native ad is failed. |
testing | Assign | The property is used to inform AdFalcon network that the app is under the testing mode rather than production mode. Before releasing your app ensure this is set to NO. |
Logging | Assign | Enable logging |
delegate | Weak | ADFNativeAdDelegate value, this property is used to pass the delegate of native ad. |
Method | Description | ||
– (void) initializeWithSiteID:(NSString*) siteID adTemplateClass:(Class) adTemplateClass viewController:(UIViewController *) viewController; | This method should be called only once, before calling loadAd method.
Method Parameters: · siteID: pass the site id which you got from adfalcon website. · adTemplate: pass your ad template class. · viewController: pass the view controller which contains the native ad. |
||
– (void) loadAdWithParams:(ADFTargetingParams*) targetingParams; | This method is used to load new ad.
Method Parameters: · ADFTargetingParams: Ad Request Targeting Parameters |
||
ADFNativeAdTemplate Protocol
Method | Required | Description |
-(void) bindViews:(ADFNativeAdBinder*) binder; | Yes | This method is used to connect your native ad template’s views to their corresponding native ad assets (title view, main image, icon, etc.).
You should at minimum bind one of the mandatory native ad assets (icon, title or MainAsset) depending on the native ad template design in-place.
Optionally, the binder allows setting additional parameters of the native ad assets such as the width and height of the icon and image, the maximum length of the title otherwise the binder will infer this information from the UIView’s properties.
Binding views to native ad assets is achieved using the binder object of ADFNativeAdBinder class by calling the appropriate binding method (setIconImageView, setTitleLabel, setMainAssetView and setExtraData).
|
-(CGSize) sizeForWidth:(CGFloat) width; | Yes | This method is used to calculate the size of your native ad template view for the given parent view width or screen width. This is used while inferring the different attributes of your native ad views such as maximum length of your text views, and width and height of your image views. |
-(void) renderExtraData:(NSDictionary*) extraData | No | This method is used to allow the app to draw any extra data assets that were not bound explicitly in bindViews method.
This is used if the app is willing to entirely take over the extra data display and presentation. |
ADFNativeAdDelegate Protocol
Method | Required | Description |
-(void) nativeAdDidLoad:(ADFNativeAd*) nativeAd; | Yes | Fired when the ad is loaded successfully. |
-(void) nativeAd:(ADFNativeAd*) nativeAd
didFailWithErrorCode:(int) code message:(NSString*) message; |
Yes | Fired when failed to load an ad with failure reason. |
-(BOOL) nativeAd:(ADFNativeAd*) nativeAd handleCustomActionWithData:(NSString *)customData; | No | This method will be invoked by the SDK if the action type of an ad is custom.
Method Parameters: · ADFNativeAd: Native ad object · customData: The Ad Custom data object in the format agreed on between the publisher and the advertiser; normally this is in JSON format. Return Value: Returns YES if the action has been handled successfully, otherwise return NO. |
-(void) nativeAdWillPresentScreen:(ADFNativeAd*) nativeAd; | No | This method will be invoked before presenting the ad screen. |
-(void) nativeAdDidPresentScreen:(ADFNativeAd*) nativeAd; | No | This method will be invoked after presenting the ad screen. |
-(void) nativeAdWillDismissScreen:(ADFNativeAd*) nativeAd; | No | This method will be invoked before dismissing the ad screen. |
-(void) nativeAdDidDismissScreen:(ADFNativeAd*) nativeAd; | No | This method will be invoked after dismissing the ad screen. |
ADFNativeAdError Enum
Enum | Description |
kADFNativeAdErrorInternalServer | 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
|
kADFNativeAdErrorNoAdAvailabe | no ad available in AdFalcon stores |
kADFNativeAdErrorInvalidParam | There is a parameter has invalid value |
kADFNativeAdErrorMissingParam | You have missed to fill required parameter |
kADFNativeAdErrorGenericSDK | An error happened within the SDK during attempting to load or render an ad. |
kADFNativeAdErrorCommunication | No connection available to the internet. |
kADFNativeAdErrorInterstitialAlreadyUsed | An error happened when application try to reuse Interstitial |
ADFNativeAdBinder Class
Method | Description | ||||||||||||||||||||||||||||||||||||||||||
-(void) setIconImageView:(UIImageView*) imageView;
-(void) setIconImageView:(UIImageView*) imageView minSize:(CGSize) minSize; |
Binds the native ad icon asset to its corresponding UIImageView in the template.
The first method is used to pass the template’s icon image view. The SDK will determine the image view size and return the best size for your icon.
Or you can use the overloaded method to explicitly set the minimum size of the requested icon.
The size of any icon must be a square i.e. the width is equal to the height.
Recommended minimum width and height of the Icon UIImageView is 50×50.
|
||||||||||||||||||||||||||||||||||||||||||
-(void) setTitleLabel:(UILabel*) label;
-(void) setTitleLabel:(UILabel *)label maxLength:(CGFloat) maxLength; |
Binds the native ad title asset to its corresponding UILabel in the template.
The first method is used to pass the label view of the template’s title. The SDK will infer the maximum length of the label based on UILabel properties.
Or you can use the overloaded method to explicitly set the maximum length of the title.
It is recommended that the UILabel is laid out to display at least 25 characters.
|
||||||||||||||||||||||||||||||||||||||||||
-(void) setMainAssetView:(UIView *) view;
-(void) setMainAssetView:(UIView *) view minSize:(CGSize) minSize; |
Binds the native ad main asset to its corresponding UIView in the template.
The MainAsset is a UIView which is used as a container view for the actual native ad main asset which can be: · Image, or · XHTML (HTML+JavaScript), or · Video
The SDK will automatically create the adequate UIView type that match the native ad main asset.
The first method is used to pass the main asset’s view, the SDK will use it to infer the minimum adequate width and height.
Or you can use the overloaded method to explicitly set the minimum required size for the main asset.
The main asset UIView width and height aspect ratio should always be W/H=1.91. It is recommended to use 320×167 points. |
||||||||||||||||||||||||||||||||||||||||||
-(void) setExtraDataView:(UIView *) view dataID:(NSInteger) dataID;
-(void) setExtraDataView:(UIView *) view dataID:(NSInteger) dataID maxLength:(CGFloat) maxLength;
-(void) setExtraDataLabel:(UILabel *) label dataID:(NSInteger) dataID maxLength:(CGFloat) maxLength
-(void) setExtraDataImageView:(UIImageView *) imageView dataID:(NSInteger) dataID minSize:(CGSize) minSize
|
Binds the native ad data asset to its corresponding UIView in the template.
All extra data views are optional which means native ad can be returned even if they don’t include the requested extra data assets. Additionally, the SDK will hide any extra data view that is not included in the returned native ad.
The first method is used to pass the view with its data id, the SDK will use the view properties to infer any needed additional parameters, such text max length, or images height and width.
The overloaded method is used to explicitly set any additional parameters.
Below is a list of supported data asset types of native ads:
|
||||||||||||||||||||||||||||||||||||||||||
starRatingEmptyColor | Change the color of empty area in star rating | ||||||||||||||||||||||||||||||||||||||||||
starRatingFillingColor | Change the color of filling area in star rating | ||||||||||||||||||||||||||||||||||||||||||
-(void) setAdChoicesView:(UIView *) view; | Binds the native ad AdChoices asset to its corresponding UIView in the template. It is a Mandatory field.
An AdChoices icon must be displayed in your ad to enable the user to learn about interest-based advertising. The SDK will decide when it is needed to display the icon and will also handle the tap event on the view by opening an opt-out page in the browser.
The size of the view: 20×20.
You must place the view in any one of the four corners of the ad template; upper right hand corner is recommended. |