iOS SDK  7.3.0
 All Classes Files Functions Properties Pages
FlurryAds Class Reference

Provides all available methods for displaying ads. More...

#import <FlurryAds.h>

Inherits NSObject.

Class Methods

(void) + fetchAdForSpace:frame:size:
 Retrieves an ad for the given space. More...
 
(BOOL) + adReadyForSpace:
 Returns if an ad is currently ready to display for a given space. More...
 
(void) + displayAdForSpace:onView:viewControllerForPresentation:
 Display an ad for the given space. More...
 
(void) + displayAdForSpace:modallyForViewController:
 [Deprecated] Display an ad for the given interstitial space. More...
 
(void) + fetchAndDisplayAdForSpace:view:viewController:size:
 Fetch and Display an ad for the given space. More...
 
(void) + removeAdFromSpace:
 Removes an ad for the given space. More...
 
(void) + initialize:
 Initializes the ad serving system. More...
 
(void) + setAdDelegate:
 Sets the object to receive various delegate methods. More...
 
(void) + enableTestAds:
 Informs server to send test ads. More...
 
(void) + setUserCookies:
 Sets a dictionary of key/value pairs, which will be transmitted to Flurry servers when a user clicks on an ad. More...
 
(void) + clearUserCookies
 Removes a previously set dictionary of key/value pairs. More...
 
(void) + setKeywordsForTargeting:
 Sets a dictionary of key/value pairs, which will be transmitted to Flurry servers when an ad is requested. More...
 
(void) + clearKeywords
 Removes a previously set dictionary of key/value pairs. More...
 
(void) + addCustomAdNetwork:withProperties:
 Method to add a custom ad network to be served through the standard Flurry ad system. More...
 

Detailed Description

Provides all available methods for displaying ads.

Set of methods that allow publishers to configure, target, and deliver ads to their customers.

Note
This class depends on Flurry.h. For information on how to use Flurry's Ads SDK to attract high-quality users and monetize your user base see Support Center - Publishers.
Author
2009 - 2013 Flurry, Inc. All Rights Reserved.
Version
4.3.0

Definition at line 33 of file FlurryAds.h.

Method Documentation

+ (void) addCustomAdNetwork: (Class< FlurryCustomAdNetwork >)  adNetworkClass
withProperties: (id< FlurryCustomAdNetworkProperties >)  adNetworkProperties 

Method to add a custom ad network to be served through the standard Flurry ad system.

Since
4.0.0

This method adds a network with the necessary publisher supplied properties to the Flurry sdk.

See Also
FlurryCustomAdNetwork and FlurryCustomAdNetworkProperties for details.
+ (BOOL) adReadyForSpace: (NSString *)  space

Returns if an ad is currently ready to display for a given space.

Since
4.1.0

This method will verify if there is an ad is currently available for this user. If an ad is not available, you may call #fetchAdForSpace:view:size: to load a new ad.

Note
If this method returns YES, an ad will be available when you attempt to display an ad. However, it is still advisable to listen to the delegate FlurryAdsDelegate::spaceDidFailToRender:.
The space simply represents the placement of the ad in your app and should be unique for each placement. For example, if you are displaying a full screen ad on your splash screen and after level completeion, you may have the following spaces "SPLASH_AD" and @c @"LEVEL_AD".
See Also
#fetchAdForSpace:view:size: for details on retrieving an ad.
#displayAdForSpace: for details on displaying the available ad.
- (void)showButtonForAd:(NSString *)placement
{
// Placement may be SPLASH_AD as noted above
if([FlurryAds adReadyForSpace:placement])
{
// Show button that ads are available.
}
}
Parameters
spaceThe placement of an ad in your app, where placement may be splash screen for SPLASH_AD.
Returns
YES/NO to indicate if an ad is ready to be displayed.
+ (void) clearKeywords

Removes a previously set dictionary of key/value pairs.

Since
4.0.0

This method removes information from the one keywords object.

See Also
#setKeywords: for details on setting keywords.
+ (void) clearUserCookies

Removes a previously set dictionary of key/value pairs.

Since
4.0.0

This method removes information from the one UserCookie object.

See Also
+ setUserCookies: for details on setting user cookies.
+ (void) displayAdForSpace: (NSString *)  space

[Deprecated] Display an ad for the given interstitial space.

Since
4.2.2
Deprecated:
5.4.0

This method will display an interstitial ad if one is ready for display on the device for specified UIViewController instance [Deprecated] displayAdForSpace:onView:viewControllerForPresentation: is the preferred routine for showing interstitials.

Note
The space simply represents the placement of the ad in your app and should be unique for each placement. Only one ad will show at a time for any given ad space. For example, if you are displaying a full screen ad on your splash screen and after level completeion, you may have the following spaces "SPLASH_AD" and @c @"LEVEL_AD".
See Also
#fetchAdForSpace:view:size: for details on retrieving an ad.
+ adReadyForSpace: for details on verifying is an ad is ready to be displayed.
+ removeAdFromSpace: for details on manually removing an ad from a view.
- spaceShouldDisplay:forType: (FlurryAdDelegate-p) for details on controlling whether an ad will display immediately before it is set to be rendered to the user. - spaceDidFailToRender:error: (FlurryAdDelegate-p) for details on notification of error in rendering an ad for this request.
in UIViewController based class:
- (void)showFullscreenAd:(NSString *)placement
{
// Placement may be SPLASH_AD as noted above
if([FlurryAds adReadyForSpace:placement])
{
[FlurryAds displayAdForSpace:placement modallyForViewController:self];
}
}
Parameters
spaceThe placement of an ad in your app, where placement may
viewControllerThe viewController to show the fullscreen ad modally. Note this method should not be used for banners.
+ (void) displayAdForSpace: (NSString *)  space
onView: (UIView *)  view
viewControllerForPresentation: (UIViewController *)  viewControllerForPresentation 

Display an ad for the given space.

Since
4.1.0 5.4.0

This method will display an ad if one is ready for display on the device.

Note
The space simply represents the placement of the ad in your app and should be unique for each placement. Only one ad will show at a time for any given ad space. For example, if you are displaying a full screen ad on your splash screen and after level completeion, you may have the following spaces "SPLASH_AD" and @c @"LEVEL_AD".
See Also
#fetchAdForSpace:view:size: for details on retrieving an ad.
+ adReadyForSpace: for details on verifying is an ad is ready to be displayed.
+ removeAdFromSpace: for details on manually removing an ad from a view.
- spaceShouldDisplay:forType: (FlurryAdDelegate-p) for details on controlling whether an ad will display immediately before it is set to be rendered to the user. - spaceDidFailToRender:error: (FlurryAdDelegate-p) for details on notification of error in rendering an ad for this request.
- (void)showFullscreenAd:(NSString *)placement
{
// Placement may be SPLASH_AD as noted above
if([FlurryAds adReadyForSpace:placement])
{
[FlurryAds displayAdForSpace:placement onView:self.view viewControllerForPresentation:self];
}
}
Parameters
spaceThe placement of an ad in your app, where placement may
viewThe view to place the ad. The view frame should be identical to the view frame passed in #fetchAdForSpace:frame:size. Note view is not used for interstitials.
viewControllerForPresentationThe viewController to show the fullscreen ad modally. be splash screen for SPLASH_AD.
+ (void) enableTestAds: (BOOL)  enable

Informs server to send test ads.

Since
4.0

This method allows you to request test ads from the server. These ads do not generate revenue so it is CRITICAL this call is removed prior to app submission.

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY"];
[FlurryAds enableTestAds:YES];
// ....
}
Parameters
enableYES to receive test ads to the device. Not including this method is equivalent to passing NO.
+ (void) fetchAdForSpace: (NSString *)  space
frame: (CGRect)  frame
size: (FlurryAdSize)  size 

Retrieves an ad for the given space.

Since
4.1.0

This method will attempt to retrieve ads for the given space from the Flurry server.

Note
The space simply represents the placement of the ad in your app and should be unique for each placement. For example, if you are displaying a full screen ad on your splash screen and after level completeion, you may have the following spaces "SPLASH_AD" and @c @"LEVEL_AD".
See Also
+ removeAdFromSpace: for details on manually removing an ad from a view.
- spaceDidReceiveAd: (FlurryAdDelegate-p) for details on the notification of ads being received. - spaceDidFailToReceiveAd:error: (FlurryAdDelegate-p) for details on notification of failure to receive ads from this request. #displayAdForSpace: for details on displaying an available ad.
- (void)fetchAd:(NSString *)placement
{
// Placement may be SPLASH_AD as noted above
[FlurryAds fetchAdForSpace:placement view:self.view.frame size:FULLSCREEN];
}
// Show whenever delegate is invoked
- (void) spaceDidReceiveAd:(NSString *)adSpace {
// Received Ad
[FlurryAds displayAdForSpace:adSpace];
}
// Alternatively, try to display at a certain point in the app
- (void) levelComplete {
if([FlurryAds adReadyForSpace:adSpace]) {
[FlurryAds displayAdForSpace:adSpace];
}
}
Parameters
spaceThe placement of an ad in your app, where placement may be splash screen for SPLASH_AD.
frameThe frame of the view that will be used for the ad container.
sizeThe default size of an ad space. This can be overriden on the server. See FlurryAdSize in the FlurryAds.h file for allowable values.
+ (void) fetchAndDisplayAdForSpace: (NSString *)  space
view: (UIView *)  viewContainer
viewController: (UIViewController *)  viewControllerForPresentation
size: (FlurryAdSize)  size 

Fetch and Display an ad for the given space.

Since
4.0.0 5.4.0

This method will display an ad if one is available from the Flurry server for this user.

Note
If this method returns YES, an ad is available for the space within timeout.
This is a blocking method that allows you to change the user experience based on availability of an ad. If you would like to display an ad asynchronously, just set timeout to 0. This is useful in the case of banners for instance where the user should not wait for its display. If you are loading async with timeout set to 0, ignore the return value of this method and rely exclusively on the relevant delegate methods listed below
The space simply represents the placement of the ad in your app and should be unique for each placement. Only one ad will show at a time for any given ad space. For example, if you are displaying a full screen ad on your splash screen and after level completeion, you may have the following spaces "SPLASH_AD" and @c @"LEVEL_AD".
See Also
+ adReadyForSpace: for details on verifying is an ad is ready to be displayed.
+ removeAdFromSpace: for details on manually removing an ad from a view.
- spaceDidReceiveAd: (FlurryAdDelegate-p) for details on the notification of ads being received. - spaceDidFailToReceiveAd:error: (FlurryAdDelegate-p) for details on notification of failure to receive ads from this request. - spaceShouldDisplay:forType: (FlurryAdDelegate-p) for details on controlling whether an ad will display immediately before it is set to be rendered to the user. - spaceDidFailToRender:error: (FlurryAdDelegate-p) for details on notification of error in rendering an ad for this request.
- (void)showFullscreenAd:(NSString *)placement
{
// Placement may be SPLASH_AD as noted above
[FlurryAds fetchAndDisplayAdForSpace:placement view:self.view viewController:self size:FULLSCREEN timeout:3000];
}
- (void)viewWillAppear:(BOOL)animated
{
// Show a banner whenever this view appears
// Display banner ad completely asyncrhonously by providing timeout == 0
[FlurryAds fetchAndDisplayAdForSpace:@"VIEW_XYZ_BANNER_AD" view:self.view size:BANNER_BOTTOM timeout:0];
}
Parameters
spaceThe placement of an ad in your app, where placement may be splash screen for SPLASH_AD.
viewThe UIView in your app that the ad will be placed as a subview. Note: for fullscreen ads, this view is not used as a container, but the size of the view may still be used for determining what types of ads will fit in this space.
sizeThe default size of an ad space. This can be overriden on the server. See FlurryAdSize in the FlurryAds.h file for allowable values.
+ (void) initialize: (UIViewController *)  rvc

Initializes the ad serving system.

Since
4.0

This method initializes the ad serving system and can be used to pre-cache ads from the server (this is done when ad spaces are configured on the server).

Note
This method must be called sometime after startSession: (Flurry).
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY"];
[FlurryAds setAdDelegate:self];
[FlurryAds initialize:myWindow.rootViewController];
// ....
}
Parameters
rvcThe primary root view controller of your app.
+ (void) removeAdFromSpace: (NSString *)  space

Removes an ad for the given space.

Since
4.0.0

This method will remove an ad if one is currently displaying.

Note
The space simply represents the placement of the ad in your app and should be unique for each placement. Only one ad will show at a time for any given ad space.
See Also
+ adReadyForSpace: for details on displaying an available ad.
+ removeAdFromSpace: for details on manually removing an ad from a view.
- spaceShouldDisplay:forType: (FlurryAdDelegate-p) for details on controlling whether an ad will display immediately before it is set to be rendered to the user.
- (void)viewDidUnload
{
// Remove a banner whenever this view dissapears
[FlurryAds removeAdFromSpace:@"VIEW_XYZ_BANNER_AD"];
}
Parameters
spaceThe placement of an ad in your app, where placement may be splash screen for SPLASH_AD.
+ (void) setAdDelegate: (id)  delegate

Sets the object to receive various delegate methods.

Since
4.0

This method allows you to register an object that will receive notifications at different phases of ad serving.

See Also
FlurryAdDelegate.h for details on delegates available.
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY"];
[FlurryAds setAdDelegate:self];
// ....
}
Parameters
delegateThe object to receive notifications of various ad actions.
+ (void) setKeywordsForTargeting: (NSDictionary *)  keywords

Sets a dictionary of key/value pairs, which will be transmitted to Flurry servers when an ad is requested.

Since
4.0.0

Keywords allow the developer to specify information on a user executing an ad action for the purposes of targeting. There is one keywords object that is transmitted to the Flurry servers on each ad request. If corresponding keywords are matched on the ad server, a subset of targeted ads will be delivered. This allows partners to supply information they track internally, which is not available to Flurry's targeting system.

Note
Calling this method with a nil or empty dictionary has no effect. Calling this method a second time with a valid dictionary will replace the previous entries. To clear previously set keywords, you must call clearKeywords.
See Also
+ clearKeywords for details on removing keywords set through this method.
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY"];
// Specify that user loves vacations
NSDictionary *keywords =
[NSDictionary dictionaryWithObjectsAndKeys:@"vacation", // Parameter Value
@"UserPreference", // Parameter Name
nil];
[FlurryAds setKeywords:keywords];
// ....
}
Parameters
keywordsThe information about the user to be used in targeting an ad. Note: do not transmit personally identifiable information in keywords.
+ (void) setUserCookies: (NSDictionary *)  userCookies

Sets a dictionary of key/value pairs, which will be transmitted to Flurry servers when a user clicks on an ad.

Since
4.0.0

UserCookies allow the developer to specify information on a user executing an ad action. There is one UserCookie object, and on each ad click that UserCookie is transmitted to the Flurry servers. The UserCookie key/value pairs will be transmitted back to the developer via the app callback if one is set. This is useful for rewarded inventory, to identify which of your users should be rewarded when a reward callback is sent.

Note
Calling this method with a nil or empty dictionary has no effect. Calling this method a second time with a valid dictionary will replace the previous entries. To clear previously set userCookies, you must call clearUserCookies.
See Also
+ clearUserCookies for details on removing user cookies set through this method.
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Optional Flurry startup methods
[Flurry startSession:@"YOUR_API_KEY"];
NSDictionary *cookies =
[NSDictionary dictionaryWithObjectsAndKeys:@"xyz123", // Parameter Value
@"UserCharacterId", // Parameter Name
nil];
[FlurryAds setUserCookies:cookies];
// ....
}
Parameters
userCookiesThe information about the user executing ad actions. Note: do not transmit personally identifiable information in the user cookies.

The documentation for this class was generated from the following file: