ALAdService Class Reference

Inherits from NSObject
Declared in ALAdService.h

Overview

This class is responsible for providing and displaying ads.

Loading and Preloading Ads

– loadNextAd:andNotify:

Fetch a new ad, of a given size, notifying a supplied delegate on completion.

- (void)loadNextAd:(alnonnull ALAdSize *)adSize andNotify:(alnullable id<ALAdLoadDelegate>)delegate

Parameters

adSize

Size of an ad to load. Must not be nil.

delegate

A callback to notify of the fact that the ad is loaded.

Discussion

Fetch a new ad, of a given size, notifying a supplied delegate on completion.

Declared In

ALAdService.h

– preloadAdOfSize:

Pre-load an ad of a given size in the background, if one is not already available.

- (void)preloadAdOfSize:(alnonnull ALAdSize *)adSize

Parameters

adSize

Size of the ad to cache.

Discussion

Pre-load an ad of a given size in the background, if one is not already available.

Declared In

ALAdService.h

– hasPreloadedAdOfSize:

Check whether an ad of a given size is pre-loaded and ready to be displayed.

- (BOOL)hasPreloadedAdOfSize:(alnonnull ALAdSize *)adSize

Parameters

adSize

Size of the ad to check for.

Return Value

YES if an ad of this size is pre-loaded and ready to display without further network activity. NO if requesting an ad of this size would require fetching over the network.

Discussion

Check whether an ad of a given size is pre-loaded and ready to be displayed.

Declared In

ALAdService.h

Observing Ad Rotations

– addAdUpdateObserver:ofSize:

Add an observer of updates of advertisements of a given size.

- (void)addAdUpdateObserver:(alnonnull id<ALAdUpdateObserver>)adListener ofSize:(alnonnull ALAdSize *)adSize

Parameters

adListener

Listener to add

adSize

Size of ads that the listener is interested in

Discussion

Add an observer of updates of advertisements of a given size.

Declared In

ALAdService.h

– removeAdUpdateObserver:ofSize:

Remove an observer of updates of advertisements of a given size.

- (void)removeAdUpdateObserver:(alnonnull id<ALAdUpdateObserver>)adListener ofSize:(alnonnull ALAdSize *)adSize

Parameters

adListener

Listener to modify

adSize

Size of ads that the listener should no longer receive notifications about

Discussion

Remove an observer of updates of advertisements of a given size.

Declared In

ALAdService.h