XARequest Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in XARequest.h

Overview

A XAAdRequest object is used to request a new advertisement from the XAPPmedia Creative Server. The type of ad can be specified as well as the type of display for an ad request. If available, contextual data can be attached to the ad request to help provide more relavent ads to the application user.

XAAdRequest objects are passed to [XAPP requestAd:], which requests the ad and then notifies the [XAPPDelegate adRequest:didFinishLoadWithView:] on a succesful request and [XAPPDelegate adRequest:didFailLoadWithError:] on a failed request.

Basic Usage

When relying on a third-party ad server, use the adRequestWithAdTag: method to request a specific ad.

XAAdRequest *request = [XARequest requestWithTag:<#Tag#>];

To rely on simple server side ad mediation, simply pass an initialized ad request.

XARequest *request = [[XARequest alloc] init];

DFP can also be used for server side ad mediation, create a request with the desired network ID, ad unit ID, and optional parameters.

XARequest request = [XARequest adRequestForDfpWithNetworkId:<#Network ID#>
                                                  andAdUnit:<#Ad Unit ID#>
                                             withParameters:<#Parameters#>];

Initializing an XAAdRequest Object

+ requestWithTag:

Request an ad by tag

+ (instancetype)requestWithTag:(NSString *)tag

Parameters

tag

The tag, typically in form Account Name/Ad Name

Return Value

The request with provided tag

Availability

Available in 3.6.0 and later

Discussion

Request an ad by tag

When relying on a third-party ad server for mediation, use this method to request an ad by tag from the XAPPmedia Creative Server.

See Also

Declared In

XARequest.h

+ adRequestForDfp

Request ad through DFP.

+ (instancetype)adRequestForDfp

Return Value

An instance of this class

Availability

Available in 3.6.0 or later

Discussion

Request ad through DFP.

Declared In

XARequest.h

+ adRequestForDfpWithNetworkId:andAdUnit:withParameters:

Request ad through DFP service

+ (instancetype)adRequestForDfpWithNetworkId:(NSNumber *)networkId andAdUnit:(NSString *)adUnit withParameters:(NSDictionary *)parameters

Parameters

networkId

DFP Network Identifier. If you want to use the default value, set this to nil, in which case adUnit must also be nil

adUnit

Ad unit name. If you want to use default settings, set this to nil in which case networkId must be nil

parameters

DFP parameters. Can be nil

Return Value

An instance of this class

Availability

Available in 3.6.0 or later

Discussion

Request ad through DFP service

Declared In

XARequest.h

Request Information

  userData

User data associated with the advertisement. Currently only used for phone calls where we call the user.

@property (nonatomic, retain) XAUserData *userData

Discussion

User data associated with the advertisement. Currently only used for phone calls where we call the user.

Declared In

XARequest.h

  uuid

Univerisal unique identifier for the request

@property (nonatomic, retain, readonly) NSString *uuid

Discussion

Univerisal unique identifier for the request

Declared In

XARequest.h

  tag

The tag of the ad to be requested, in the form Account Name/Ad Name

@property (nonatomic, retain) NSString *tag

Availability

Available in 3.6.0 and later

Discussion

The tag of the ad to be requested, in the form Account Name/Ad Name

Declared In

XARequest.h

  duration

The desired duration of the advertisement to be received

@property (nonatomic, assign) XADuration duration

Discussion

The desired duration of the advertisement to be received

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

  dfpRequest

Set YES if DFP is to be used for ad mediation

@property (nonatomic) BOOL dfpRequest

Availability

Available in 3.6.0 and later

Discussion

Set YES if DFP is to be used for ad mediation

Declared In

XARequest.h

  networkId

Network ID for DFP ad mediation, dfpRequest must be YES if used

@property (nonatomic) NSNumber *networkId

Availability

Available in 3.6.0 and later

Discussion

Network ID for DFP ad mediation, dfpRequest must be YES if used

Declared In

XARequest.h

  adUnit

Ad Unit ID for DFP ad mediation, dfpRequest must be YES if used

@property (nonatomic, retain) NSString *adUnit

Availability

Available in 3.6.0 and later

Discussion

Ad Unit ID for DFP ad mediation, dfpRequest must be YES if used

Declared In

XARequest.h

  dfpParameters

Additional parameters used for targeting with DFP ad mediation

@property (nonatomic) NSDictionary *dfpParameters

Availability

Available in 3.6.0 and later

Discussion

Additional parameters used for targeting with DFP ad mediation

Declared In

XARequest.h

Contextual Data

  genre

The current genre the user is listening to. This is used for targeting purposes.

@property (nonatomic, retain) NSString *genre

Discussion

The current genre the user is listening to. This is used for targeting purposes.

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

  stationFormat

The current station format. This is used for targeting purposes.

@property (nonatomic, retain) NSString *stationFormat

Discussion

The current station format. This is used for targeting purposes.

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

– addKeyword:

Add contextual keywords to the request for the current application context

- (void)addKeyword:(NSString *)keyword

Parameters

keyword

Contextual keyword to add to the request

Discussion

Add contextual keywords to the request for the current application context

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

– keywordsAsCommaDelimitedString

Get the keywords as a comma delimited string, used to easily pass to an ad server as meta-data.

- (NSString *)keywordsAsCommaDelimitedString

Return Value

A string of the keywords comma delimited

Discussion

Get the keywords as a comma delimited string, used to easily pass to an ad server as meta-data.

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

Location Data

  latitude

The current latitude of the application user

@property (nonatomic, assign, readonly) double latitude

Discussion

The current latitude of the application user

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

  longitude

The current longitude of the application user

@property (nonatomic, assign, readonly) double longitude

Discussion

The current longitude of the application user

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

– setLocationWithLatitude:longitude:

Helper method to set the location as GPS coordinates of the application user

- (void)setLocationWithLatitude:(double)latitude longitude:(double)longitude

Parameters

latitude

The current latitude of the device used for targeting purposes

longitude

The current longitude of the device used for targeting purposes

Discussion

Helper method to set the location as GPS coordinates of the application user

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

– setLocationWithDescription:

Set the location with a description.

- (void)setLocationWithDescription:(NSString *)locationDescription

Parameters

locationDescription

The location description to be used for targeting by location

Discussion

Set the location with a description.

If location of the application user cannot be expressed in coordinates and the general location is known, it can be set with a string description, such as “123 Main St. City, State” or more commonly the zip code.

Warning: Placeholder, this is currently not used

Declared In

XARequest.h

Development Methods

  latestAd

Used to request the latest ad from the XAPPmedia Creative Server.

@property (nonatomic, assign) BOOL latestAd

Discussion

Used to request the latest ad from the XAPPmedia Creative Server.

Warning: Warning This is a test property and may not exist in future releases

Declared In

XARequest.h

  appKey

Application Key for the request, used only for bulk ad requests

@property (nonatomic, copy) NSString *appKey

Discussion

Application Key for the request, used only for bulk ad requests

Warning: Warning This is a test property and may not exist in future releases

Declared In

XARequest.h

  apiKey

API Key for the request, used only for bulk ad requests

@property (nonatomic, copy) NSString *apiKey

Discussion

API Key for the request, used only for bulk ad requests

Warning: Warning This is a test property and may not exist in future releases

Declared In

XARequest.h