AppsfireAdSDK Class Reference

Inherits from NSObject
Declared in AppsfireAdSDK.h

Overview

Advertising SDK top-level class.

Options

+ setDelegate:

Specify the delegate to handle various interactions with the library.

+ (void)setDelegate:(id<AppsfireAdSDKDelegate>)delegate

Parameters

delegate

The pointer to the class that will handle the library events, or nil if none.

Declared In

AppsfireAdSDK.h

+ setUseInAppDownloadWhenPossible:

Specify if the library should use the in-app overlay when possible.

+ (void)setUseInAppDownloadWhenPossible:(BOOL)use

Parameters

use

A boolean to specify the choice.

Discussion

Note: If the client does not have iOS6+, it will be redirected to the App Store app. By default, this feature is set to YES.

Declared In

AppsfireAdSDK.h

+ setDebugModeEnabled:

Specify if the library should be used in debug mode.

+ (void)setDebugModeEnabled:(BOOL)use

Parameters

use

A boolean to specify if the debug mode should be enabled.

Discussion

Note: Whenever this mode is enabled, the web service will return a fake ad. By default, this mode is disabled. You must decide if you want to enable the debug mode before any prepare/request.

Declared In

AppsfireAdSDK.h

Modal Ads

+ requestModalAd:withController:withDelegate:

Request a modal ad.

+ (void)requestModalAd:(AFAdSDKModalType)modalType withController:(UIViewController *)controller withDelegate:(id<AFAdSDKModalDelegate>)delegate

Parameters

modalType

The kind of modal you want to request.

controller

A controller that will be used to display the various components. We recommend you specify the root controller or your application. If you don’t specify a controller, the request will be aborted. Note that we’ll retain the controller with a strong attribute.

delegate

(optional) The delegate that will receive any specific event related to your request.

Availability

2.4

Discussion

Note: If the library isn’t initialized, or if the ads aren’t loaded yet, then the request will be added to a queue and treated as soon as possible. You cannot request two ad modals at the same time. In the case where you already have a modal request in the queue, the previous one will be canceled.

Declared In

AppsfireAdSDK.h

+ isThereAModalAdAvailableForType:

Ask if ads are loaded and if there is at least one modal ad available.

+ (AFAdSDKAdAvailability)isThereAModalAdAvailableForType:(AFAdSDKModalType)modalType

Parameters

modalType

The kind of modal you want to check. Note that most of ads should be available for both formats.

Return Value

AFAdSDKAdAvailabilityPending if ads aren’t loaded yet, AFAdSDKAdAvailabilityYes and if there is at least one modal ad available, AFAdSDKAdAvailabilityNo otherwise.

Availability

2.2

Discussion

Note: If ads aren’t downloaded yet, then the method will return AFAdSDKAdAvailabilityPending. To test the library, and then have always have a positive response, please use the “debug” mode (see online documentation for more precisions).

Declared In

AppsfireAdSDK.h

+ forceDismissalOfModalAd

Force the dismissal of any modal ad currently being displayed on the screen.

+ (BOOL)forceDismissalOfModalAd

Return Value

YES if a modal ad was dismissed, NO otherwise.

Availability

2.2.2

Discussion

Note: In the majority of cases, you shouldn’t use this method. We highly recommend not to use this method if you aren’t sure of the results. Please refer to the documentation or contact us if you have any doubt!

Declared In

AppsfireAdSDK.h

+ cancelPendingAdModalRequest

Cancel any pending ad modal request you have made in the past.

+ (BOOL)cancelPendingAdModalRequest

Return Value

YES if a modal ad was canceled, NO otherwise. If YES is returned, you’ll get an delegate event via ‘modalAdRequestDidFailWithError:’.

Declared In

AppsfireAdSDK.h

+ isModalAdDisplayed

Check if there is any modal ad being displayed right now by the library.

+ (BOOL)isModalAdDisplayed

Return Value

YES if a modal ad is being displayed, NO otherwise

Declared In

AppsfireAdSDK.h

Sashimi Ads

+ numberOfSashimiAdsAvailableForFormat:

Get the number of available sashimi ads for a specific format.

+ (NSUInteger)numberOfSashimiAdsAvailableForFormat:(AFAdSDKSashimiFormat)format

Parameters

format

The kind of sashimi view you would like to get.

Return Value

The number of available sashimi ads.

Availability

2.2

Discussion

Note: If ads aren’t downloaded yet, then the method will return 0. To test the library, and then have a positive response, please use the “debug” mode.

Declared In

AppsfireAdSDK.h

+ numberOfSashimiAdsAvailableForSubclass:

Get the number of available sashimi ads for a specific class.

+ (NSUInteger)numberOfSashimiAdsAvailableForSubclass:(Class)viewClass

Parameters

viewClass

A subclass of AFAdSDKSashimiView. Please check the documentation for a good implementation.

Return Value

The number of available sashimi ads.

Availability

2.2

Discussion

Note: If ads aren’t downloaded yet, then the method will return 0. To test the library, and then have a positive response, please use the “debug” mode.

Declared In

AppsfireAdSDK.h

+ numberOfSashimiAdsAvailableForNibName:

Get the number of available sashimi ads for a specific nib name.

+ (NSUInteger)numberOfSashimiAdsAvailableForNibName:(NSString *)nibName

Parameters

nibName

A xib which is a subclass of AFAdSDKSashimiView. Please check the documentation for a good implementation.

Return Value

The number of available sashimi ads.

Availability

2.4

Discussion

Note: If ads aren’t downloaded yet, then the method will return 0. To test the library, and then have a positive response, please use the “debug” mode.

Declared In

AppsfireAdSDK.h

+ isThereSashimiAdAvailableForSubclass:

Ask if ads are loaded and if there is at least one sashimi ad available.

+ (AFAdSDKAdAvailability)isThereSashimiAdAvailableForSubclass:(Class)viewClass

Parameters

viewClass

A subclass of AFAdSDKSashimiView. Please check the documentation for a good implementation.

Return Value

AFAdSDKAdAvailabilityPending if ads aren’t loaded yet, AFAdSDKAdAvailabilityYes and if there is at least one modal ad available, AFAdSDKAdAvailabilityNo otherwise.

Availability

2.7

Discussion

Note: If ads aren’t downloaded yet, then the method will return AFAdSDKAdAvailabilityPending. To test the library, and then have always have a positive response, please use the “debug” mode (see online documentation for more precisions).

Declared In

AppsfireAdSDK.h

+ sashimiViewForFormat:andError:

Get a sashimi view based on a format.

+ (AFAdSDKSashimiView *)sashimiViewForFormat:(AFAdSDKSashimiFormat)format andError:(NSError **)error

Parameters

format

The kind of sashimi view you would like to get.

error

If a problem occured, the error object will be filled with a code and a description.

Return Value

A view containing an ad which can be displayed right now. In case a problem occured, nil could be returned.

Availability

2.2

Declared In

AppsfireAdSDK.h

+ sashimiViewForSubclass:andError:

Get a sashimi view based on a subclass.

+ (AFAdSDKSashimiView *)sashimiViewForSubclass:(Class)viewClass andError:(NSError **)error

Parameters

viewClass

A subclass of AFAdSDKSashimiView. Please check the documentation for a good implementation.

error

If a problem occured, the error object will be filled with a code and a description.

Return Value

An UIView containing an ad which can be displayed right now. In case a problem occured, nil could be returned.

Availability

2.2

Declared In

AppsfireAdSDK.h

+ sashimiViewForNibName:andError:

Get a sashimi view based on a nib name.

+ (AFAdSDKSashimiView *)sashimiViewForNibName:(NSString *)nibName andError:(NSError **)error

Parameters

nibName

A xib which is a subclass of AFAdSDKSashimiView. Please check the documentation for a good implementation.

error

If a problem occured, the error object will be filled with a code and a description.

Return Value

An UIView containing an ad which can be displayed right now. In case a problem occured, nil could be returned.

Availability

2.4

Declared In

AppsfireAdSDK.h

Native Ads

+ isThereNativeAdAvailable

Ask if ads are loaded and if there is at least one native ad available.

+ (AFAdSDKAdAvailability)isThereNativeAdAvailable

Return Value

AFAdSDKAdAvailabilityPending if ads aren’t loaded yet, AFAdSDKAdAvailabilityYes and if there is at least one modal ad available, AFAdSDKAdAvailabilityNo otherwise.

Availability

2.7

Discussion

Note: If ads aren’t downloaded yet, then the method will return AFAdSDKAdAvailabilityPending. To test the library, and then have always have a positive response, please use the “debug” mode (see online documentation for more precisions).

Declared In

AppsfireAdSDK.h

+ numberOfNativeAdsAvailable

Get the number of available native ads

+ (NSUInteger)numberOfNativeAdsAvailable

Return Value

The number of available native ads.

Availability

2.7

Discussion

Note: If ads aren’t downloaded yet, then the method will return 0. To test the library, and then have a positive response, please use the “debug” mode.

Declared In

AppsfireAdSDK.h

+ nativeAdWithError:

Get a native ad.

+ (AFNativeAd *)nativeAdWithError:(NSError **)error

Parameters

error

If a problem occured, the error object will be filled with a code and a description.

Return Value

A AFNativeAd containing a native ad. Please check the documentation for a good implementation!

Availability

2.7

Declared In

AppsfireAdSDK.h

Library life

+ areAdsLoaded

Ask if ads are loaded from the web service

+ (BOOL)areAdsLoaded

Return Value

YES if ads are loaded from the web service.

Discussion

Note: This doesn’t necessarily means that an ad is available. But it’s always good to know if you want to debug the implementation and check that the web service responded correctly.

Declared In

AppsfireAdSDK.h