MMSDK Class Reference

Inherits from NSObject
Declared in MMSDK.h

Overview

The MMSDK class is the global singleton used to initialize the SDK state, and manage shared settings.

Initializing the MMSDK.

The appSettings object is optional for MMSDK initialization. This is a readonly object, however, its properties may be changed after initialization.

The userSettings object is also optional. This is a readwrite object, so it may be changed after initialization.

Usage example:


MMAppSettings *appSettings = [[MMAppSettings alloc] init];
appSettings.siteId = @"";
appSettings.mediator = @"";
[appSettings setCoppaCompliance:];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/dd/yyyy"];
NSDate *dateOfBirth = [dateFormatter dateFromString:@"12/25/1985"];

MMUserSettings *userSettings = [[MMUserSettings alloc] init];
userSettings.age = @(30);
userSettings.children = @(3);
userSettings.education = MMEducationBachelors;
userSettings.dob = dateOfBirth;

[[MMSDK sharedInstance] initializeWithSettings:appSettings withUserSettings:userSettings];

Other Methods

+ sharedInstance

The shared instance of the Millennial Media SDK.

+ (nonnull instancetype)sharedInstance

Return Value

The MMSDK singleton.

Discussion

The shared instance of the Millennial Media SDK.

Declared In

MMSDK.h

+ setLogLevel:

Sets the console log level for the SDK.

+ (void)setLogLevel:(MMLogLevel)level

Parameters

level

The log level to be set.

Discussion

Sets the console log level for the SDK.

Declared In

MMSDK.h

– initializeWithSettings:withUserSettings:

Initializes the SDK as a whole. This must be called before any ads are requested.

- (void)initializeWithSettings:(nullable MMAppSettings *)appSettings withUserSettings:(nullable MMUserSettings *)userSettings

Parameters

appSettings

The appSettings object. Optional.

userSettings

The userSettings object. Optional.

Discussion

Initializes the SDK as a whole. This must be called before any ads are requested.

Declared In

MMSDK.h

– version

The version of the Millennial Ad SDK.

- (nonnull NSString *)version

Return Value

The semantic version of the SDK.

Discussion

The version of the Millennial Ad SDK.

Declared In

MMSDK.h

  sendLocationIfAvailable

Whether or not to send geolocation information along with each ad request.

@property (nonatomic, assign) BOOL sendLocationIfAvailable

Discussion

Whether or not to send geolocation information along with each ad request.

When set to YES, location information is sent with ad requests ONLY if location permissions are granted for the app. Enabling this will NOT prompt the user for location authorization. Providing location data will help to serve more relevant ads to your users.

Set to NO to explicitly disable sending location information with ad requests. Default is YES.

Declared In

MMSDK.h

  locationManager

The CLLocationManager initialized and started by the Millennial Media SDK when location permission is granted by the user and sendLocationIfAvailable is set to YES.

@property (nonatomic, readonly, nullable) CLLocationManager *locationManager

Discussion

The CLLocationManager initialized and started by the Millennial Media SDK when location permission is granted by the user and sendLocationIfAvailable is set to YES.

This is a readonly property and will be nil when sending location information is explicitly disabled.

Declared In

MMSDK.h

  isInitialized

Whether or not the SDK has been initialized. The SDK must be initialized before any ads are requested.

@property (nonatomic, assign, readonly) BOOL isInitialized

Discussion

Whether or not the SDK has been initialized. The SDK must be initialized before any ads are requested.

Declared In

MMSDK.h

  appSettings

The SDK’s global settings for the application. This object must be set when initializing the SDK.

@property (nonatomic, readonly, nullable) MMAppSettings *appSettings

Discussion

The SDK’s global settings for the application. This object must be set when initializing the SDK.

Although this is a read-only property, the returned MMAppSettings object may be modified in-place to update any relevant values.

Declared In

MMSDK.h

  userSettings

The SDK’s user settings object. This can be reset during normal app operations and does not have to be provided at the time of initialization.

@property (nonatomic, readwrite, nullable) MMUserSettings *userSettings

Discussion

The SDK’s user settings object. This can be reset during normal app operations and does not have to be provided at the time of initialization.

Declared In

MMSDK.h

Plugins Methods

– registerPlugin:version:

Registers the specified plugin as available to the SDK to fulfill ad requests. This should only be called as part of a plugin’s +load method or during another type of automatic plugin initialization. The SDK is not required to be initialized before registering a plugin.

- (void)registerPlugin:(NSString *)pluginName version:(NSString *)version

Parameters

pluginName

The registered name of the plugin.

version

The semantic version of the plugin.

Discussion

Registers the specified plugin as available to the SDK to fulfill ad requests. This should only be called as part of a plugin’s +load method or during another type of automatic plugin initialization. The SDK is not required to be initialized before registering a plugin.

Any plugin must be registered with Milliennal Media in order to be operable. Registering unrecognized plugins with the SDK will have no effect.

Declared In

MMSDK+Plugins.h

  plugins

The full set of registered plugins, as name: version key/value pairs.

@property (nonatomic, readonly) NSDictionary *plugins

Discussion

The full set of registered plugins, as name: version key/value pairs.

Declared In

MMSDK+Plugins.h

ClientMediation Methods

+ mediatorNamed:

Gets a client mediator with the specified name.

+ (id<MMClientMediator>)mediatorNamed:(NSString *)name

Parameters

name

The name of the mediator to retrieve. This is provided in the playlist by the gateway/endpoint.

Return Value

An object which represents the mediation interface to the client SDK.

Discussion

Gets a client mediator with the specified name.

Declared In

MMSDK+ClientMediation.h

+ registerMediator:named:

Registers a client mediator object with the system.

+ (void)registerMediator:(id<MMClientMediator>)mediator named:(NSString *)mediatorName

Parameters

mediator

The mediator object to use. This object is responsible for managing the interations between the Millennial SDK and the client SDK.

mediatorName

The name of the mediator. This will be a value that is provided by Millennial Media, and is used internally as a return value from the request gateway/endpoint to identify this client mediation interface.

Discussion

Registers a client mediator object with the system.

Declared In

MMSDK+ClientMediation.h