MLInstallation Class Reference

Inherits from MLObject : NSObject
Conforms to MLSubclassing
Declared in MLInstallation.h

Overview

An Installation Object is a local representation of an installation persisted to the MaxLeap. This class is a subclass of a MLObject, and retains the same functionality of a MLObject, but also extends it with installation-specific fields and related immutability and validity checks.

A valid MLInstallation can only be instantiated via [MLInstallation currentInstallation] because the required identifier fields are readonly. The timeZone and badge fields are also readonly properties which are automatically updated to match the device’s time zone and application badge when the MLInstallation is saved, thus these fields might not reflect the latest device state if the installation has not recently been saved.

MLInstallation objects which have a valid deviceToken and are saved to the MaxLeap can be used to target push notifications.

This class is currently for iOS only. There is no MLInstallation for MaxLeap applications running on OS X, because they cannot receive push notifications.

Other Methods

+ leapClassName

The name of the Installation class in the REST API. This is a required MLSubclassing method

+ (NSString *)leapClassName

Declared In

MLInstallation.h

Targeting Installations

+ query

Creates a query for MLInstallation objects. The resulting query can only be used for targeting a MLPush. Calling find methods on the resulting query will raise an exception.

+ (MLQuery *)query

Return Value

Return a query for MLInstallation objects.

Declared In

MLInstallation.h

Accessing the Current Installation

+ currentInstallation

Gets the currently-running installation from disk and returns an instance of it. If this installation is not stored on disk, returns a MLInstallation with deviceType and installationId fields set to those of the current installation.

+ (instancetype)currentInstallation

Return Value

Returns a MLInstallation that represents the currently-running installation.

Declared In

MLInstallation.h

Properties

– setDeviceTokenFromData:

Sets the device token string property from an NSData-encoded token.

- (instancetype)setDeviceTokenFromData:(nullable NSData *)deviceTokenData

Parameters

deviceTokenData

The deviceToken got from application:didRegisterForRemoteNotificationsWithDeviceToken: method.

Declared In

MLInstallation.h

– setDeviceTokenFromData:forSandbox:

Sets the device token string property from an NSData-encoded token.

- (instancetype)setDeviceTokenFromData:(nullable NSData *)deviceTokenData forSandbox:(BOOL)forSandbox

Parameters

deviceTokenData

The deviceToken got from application:didRegisterForRemoteNotificationsWithDeviceToken: method.

forSandbox

Whether the remote push notification is under production envrionment.

Declared In

MLInstallation.h

  sandbox

Whether the remote push notification is under development envrionment. Generally, the DEBUG configuration uses development push certificate and the RELEASE configuration uses production push certificate.

@property (nonatomic) BOOL sandbox

Declared In

MLInstallation.h

  deviceType

The device type for the MLInstallation.

@property (nonatomic, readonly, strong) NSString *deviceType

Declared In

MLInstallation.h

  installationId

The installationId for the MLInstallation.

@property (nonatomic, readonly, strong) NSString *installationId

Declared In

MLInstallation.h

  deviceToken

The device token for the MLInstallation.

@property (nonatomic, strong, nullable) NSString *deviceToken

Declared In

MLInstallation.h

  badge

The badge for the MLInstallation.

@property (nonatomic, assign) NSInteger badge

Declared In

MLInstallation.h

  timeZone

The timeZone for the MLInstallation.

@property (nonatomic, readonly, strong, nullable) NSString *timeZone

Declared In

MLInstallation.h

  channels

The channels for the MLInstallation.

@property (nonatomic, strong, nullable) NSArray *channels

Declared In

MLInstallation.h