AdColony Class Reference
Inherits from | NSObject |
---|---|
Declared in | AdColonyPublic.h |
Starting AdColony
+ configureWithAppID:options:completion:
Configures AdColony specifically for your app; required for usage of the rest of the API.
+ (void)configureWithAppID:(NSString *)appID options:(nullable AdColonyAppOptions *)options completion:(nullable void ( ^ ) ( NSArray<AdColonyZone*> *zones ))completion
Parameters
appID |
The AdColony app ID for your app. |
---|---|
options |
(optional) Configuration options for your app. |
completion |
(optional) A block of code to be executed upon completion of the configuration operation. Dispatched on main thread. |
Discussion
This method returns immediately; any long-running work such as network connections are performed in the background.
AdColony does not begin preparing ads for display or performing reporting until after it is configured by your app.
The required appID parameter for this method can be created and retrieved at the Control Panel.
If appID is nil
, app will be unable to play ads and AdColony will only provide limited reporting and install-tracking functionality.
Please note the completion handler. You should not start requesting ads until it has fired.
If there is a configuration error, the set of zones passed to the completion handler will be nil.
See Also
Declared In
AdColonyPublic.h
+ configureWithAppID:zoneIDs:options:completion:
Configures AdColony specifically for your app; required for usage of the rest of the API. (Deprecated: please use configure without zoneIDs)
+ (void)configureWithAppID:(NSString *)appID zoneIDs:(NSArray<NSString*> *)zoneIDs options:(nullable AdColonyAppOptions *)options completion:(nullable void ( ^ ) ( NSArray<AdColonyZone*> *zones ))completion
Parameters
appID |
The AdColony app ID for your app. |
---|---|
zoneIDs |
An array of at least one AdColony zone ID string. |
options |
(optional) Configuration options for your app. |
completion |
(optional) A block of code to be executed upon completion of the configuration operation. Dispatched on main thread. |
Discussion
This method returns immediately; any long-running work such as network connections are performed in the background.
AdColony does not begin preparing ads for display or performing reporting until after it is configured by your app.
The required appID and zoneIDs parameters for this method can be created and retrieved at the Control Panel.
If either of these are nil
, app will be unable to play ads and AdColony will only provide limited reporting and install-tracking functionality.
Please note the completion handler. You should not start requesting ads until it has fired.
If there is a configuration error, the set of zones passed to the completion handler will be nil.
See Also
Declared In
AdColonyPublic.h
+ requestInterstitialInZone:options:andDelegate:
Requests an AdColonyInterstitial.
+ (void)requestInterstitialInZone:(NSString *)zoneID options:(nullable AdColonyAdOptions *)options andDelegate:(id<AdColonyInterstitialDelegate> _Nonnull)delegate
Parameters
zoneID |
The AdColony zone identifier string indicating which zone the ad request is for. |
---|---|
options |
An AdColonyAdOptions object used to set configurable aspects of the ad request. |
delegate |
Interstitial delegate object |
Discussion
This method returns immediately, before the ad request completes. If the request is successful, an AdColonyInterstitial object will be passed to the success block. If the request is unsuccessful, the failure block will be called and an AdColonyAdRequestError will be passed to the handler.
Declared In
AdColonyPublic.h
+ requestAdViewInZone:withSize:viewController:andDelegate:
Request an AdColonyAdView.
+ (void)requestAdViewInZone:(NSString *)zoneID withSize:(AdColonyAdSize)size viewController:(UIViewController *)viewController andDelegate:(id<AdColonyAdViewDelegate>)delegate
Parameters
zoneID |
The AdColony zone identifier string indicating which zone the ad request is for. |
---|---|
size |
The desired size of the banner ad view. |
viewController |
Host view controller |
delegate |
ad view delegate |
Discussion
This method returns immediately, before the ad request completes. If the request is successful, an AdColonyAdView object will be passed to the success block. If the request is unsuccessful, an AdColonyAdRequestError object will be passed to the failure block.
Declared In
AdColonyPublic.h
+ requestAdViewInZone:withSize:andOptions:viewController:andDelegate:
Request an AdColonyAdView.
+ (void)requestAdViewInZone:(NSString *)zoneID withSize:(AdColonyAdSize)size andOptions:(nullable AdColonyAdOptions *)options viewController:(UIViewController *)viewController andDelegate:(id<AdColonyAdViewDelegate>)delegate
Parameters
zoneID |
The AdColony zone identifier string indicating which zone the ad request is for. |
---|---|
size |
The desired size of the banner ad view. |
options |
An AdColonyAdOptions object used to set configurable aspects of the ad request. |
viewController |
Host view controller |
delegate |
ad view delegate |
Discussion
This method returns immediately, before the ad request completes. If the request is successful, an AdColonyAdView object will be passed to the success block. If the request is unsuccessful, an AdColonyAdRequestError object will be passed to the failure block.
Declared In
AdColonyPublic.h
+ requestAdViewInZone:withSize:options:andDelegate:
Request an AdColonyAdView.
+ (void)requestAdViewInZone:(NSString *)zoneID withSize:(AdColonyAdSize)size options:(nullable AdColonyAdOptions *)options andDelegate:(id<AdColonyAdViewAdvancedDelegate>)delegate
Parameters
zoneID |
The AdColony zone identifier string indicating which zone the ad request is for. |
---|---|
size |
The desired size of the banner ad view. |
options |
An AdColonyAdOptions object used to set configurable aspects of the ad request. |
delegate |
ad view advanced delegate |
Discussion
This method returns immediately, before the ad request completes. If the request is successful, an AdColonyAdView object will be passed to the delegate adColonyAdViewDidLoad: method. If the request is unsuccessful, an AdColonyAdRequestError object will be passed to the delegate adColonyAdViewDidFailToLoad method.
Declared In
AdColonyPublic.h
Zone
+ zoneForID:
Retrieves an AdColonyZone object.
+ (nullable AdColonyZone *)zoneForID:(NSString *)zoneID
Parameters
zoneID |
The AdColony zone identifier string indicating which zone to return. |
---|
Return Value
An AdColonyZone object. Returns nil
if an invalid zone ID is passed.
Discussion
AdColonyZone objects aggregate informative data about unique AdColony zones such as their identifiers, whether or not they are configured for rewards, etc. AdColony zone IDs can be created and retrieved at the Control Panel.
See Also
Declared In
AdColonyPublic.h
Device Identifiers
+ getAdvertisingID
Retrieves the device’s current advertising identifier.
+ (NSString *)getAdvertisingID
Return Value
The device’s current advertising identifier.
Discussion
The identifier is an alphanumeric string unique to each device, used by systems to facilitate ad serving.
Note that this method can be called before configureWithAppID:zoneIDs:options:completion
.
Declared In
AdColonyPublic.h
+ getUserID
Retrieves a custom identifier for the current user if it has been set.
+ (NSString *)getUserID
Return Value
The identifier for the current user.
Discussion
This is an arbitrary, application-specific identifier string for the current user.
To configure this identifier, use the setOption:withStringValue
method of the AdColonyAppOptions object you pass to configureWithAppID:zoneIDs:options:completion
.
Note that if this method is called before configureWithAppID:zoneIDs:options:completion
, it will return an empty string.
See Also
Declared In
AdColonyPublic.h
App Options
+ setAppOptions:
Sets the current, global set of AdColonyAppOptions.
+ (void)setAppOptions:(AdColonyAppOptions *)options
Parameters
options |
The AdColonyAppOptions object to be used for configuring global options such as a custom user identifier. |
---|
Discussion
Use the object’s option-setting methods to configure currently-supported options.
See Also
Declared In
AdColonyPublic.h
+ getAppOptions
Returns the current, global set of AdColonyAppOptions.
+ (nullable AdColonyAppOptions *)getAppOptions
Return Value
The current AdColonyAppOptions object being used by the SDK.
Discussion
Use this method to obtain the current set of app options used to configure SDK behavior.
If no options object has been set, this method will return nil
.
See Also
Declared In
AdColonyPublic.h
Custom Messages
+ sendCustomMessageOfType:withContent:reply:
Sends a custom message to the AdColony SDK.
+ (void)sendCustomMessageOfType:(NSString *)type withContent:(nullable NSString *)content reply:(nullable void ( ^ ) ( _Nullable id reply ))reply
Parameters
type |
The type of the custom message. Must be 128 characters or less. |
---|---|
content |
The content of the custom message. Must be 1024 characters or less. |
reply |
A block of code to be executed when a reply is sent to the custom message. Will be dispatched on main thread. |
Discussion
Use this method to send custom messages to the AdColony SDK.
Declared In
AdColonyPublic.h
In-app purchase (IAP) Tracking
+ iapCompleteWithTransactionID:productID:price:currencyCode:
Reports IAPs within your application.
+ (void)iapCompleteWithTransactionID:(NSString *)transactionID productID:(NSString *)productID price:(nullable NSNumber *)price currencyCode:(nullable NSString *)currencyCode
Parameters
transactionID |
An NSString representing the unique SKPaymentTransaction identifier for the IAP. Must be 128 chars or less. |
---|---|
productID |
An NSString identifying the purchased product. Must be 128 chars or less. |
price |
(optional) An NSNumber indicating the total price of the items purchased. |
currencyCode |
(optional) An NSString indicating the real-world, three-letter ISO 4217 (e.g. USD) currency code of the transaction. |
Discussion
Note that this API can be used to report standard IAPs as well as those triggered by AdColony’s IAP Promo (IAPP) advertisements. Leveraging this API will improve overall ad targeting for your application.
Declared In
AdColonyPublic.h
SDK Version
+ getSDKVersion
Retrieve a string-based representation of the SDK version.
+ (NSString *)getSDKVersion
Return Value
The current AdColony SDK version string.
Discussion
The returned string will be in the form of “
Declared In
AdColonyPublic.h
+ collectSignals
Gathers AdColony specific information to be passed into OpenRTB bid request. (Deprecated: please use asynchronous version)
+ (NSString *)collectSignals
Return Value
The String to be passed into OpenRTB bid requests, or an empty String if AdColony has not yet been configured.
Discussion
Gathers AdColony specific information to be passed into OpenRTB bid requests from a mediation setting.
Declared In
AdColonyPublic.h
+ collectSignals:
Gathers AdColony specific information to be passed into OpenRTB bid request.
+ (void)collectSignals:(nonnull void ( ^ ) ( NSString *_Nullable signals , NSError *_Nullable error ))completion
Parameters
completion |
A block of code to be executed when collection finishes, with result or error, on calling thread or main thread if unable to schedule on calling thread. |
---|
Discussion
Gathers AdColony specific information to be passed into OpenRTB bid requests from a mediation setting.
Declared In
AdColonyPublic.h
+ collectSignals:targetDispatch:
Gathers AdColony specific information to be passed into OpenRTB bid request.
+ (void)collectSignals:(nonnull void ( ^ ) ( NSString *_Nullable signals , NSError *_Nullable error ))completion targetDispatch:(nullable dispatch_queue_t)dispatch
Parameters
completion |
A block of code to be executed when collection finishes, with result or error, on target dispatch. If nil dispatch is provided, this method behaves like collectSignals:. |
---|---|
dispatch |
Target dispatch queue for completion callback block |
Discussion
Gathers AdColony specific information to be passed into OpenRTB bid requests from a mediation setting.
Declared In
AdColonyPublic.h