Inherits from NSObject
Declared in MaaSAlerts.h

Overview

MaaSAlerts enables easy implementation of alerts and notifications. It encapsulates advanced push features such as subscriber groups and fetching extra information related to a push notification.

Subscription Groups

MaaSAlerts provides the ability to provide users a list of subscription groups from which more filtered alerts and notifications can be received. There are two methods the facilitate this, getSubscriptionGroupsWithSuccess:failure: and subscribeToGroupsWithIDs:success:failure:.

Development

During the development of your application you may want to utilize Apple’s push notification sandbox. To enable development mode for MaaSAlerts you would call [MaaSAlerts setDevelopmentModeEnabled:YES]. If you omit this call MaaSAlerts will default to Apple’s production push notification system.

Tasks

Required Methods

Subscription Groups

Other Methods

Class Methods

APNSToken

Returns Apple push token. Call after didRegisterForRemoteNotificationsWithDeviceToken:. Calling before will return nil.

+ (NSString *)APNSToken

Declared In

MaaSAlerts.h

didFailToRegisterForRemoteNotificationsWithError:

Call inside application:didFailToRegisterForRemoteNotificationsWithError:

+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

Parameters

error

An NSError object that encapsulates information why registration did not succeed. The application can display this information to the user.

Declared In

MaaSAlerts.h

didReceiveRemoteNotification:

Called inside application:didReceiveRemoteNotification:. This method assumes all notifications received were opened by the user and triggers a push analytics payload.

+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo

Parameters

userInfo

A dictionary that contains information related to the remote notification, specifically a badge number for the application icon, a notification identifier, and possibly custom data. The provider originates it as a JSON-defined dictionary that AppKit converts to an NSDictionary object; the dictionary may contain only property-list objects plus NSNull.

Declared In

MaaSAlerts.h

didReceiveRemoteNotificationForPushID:

Called when you want to explicitly trigger a push analytics event. This method should only be called when the user consumes a push notification.

+ (void)didReceiveRemoteNotificationForPushID:(NSString *)pushID

Parameters

pushID

The remote notification push ID. The pushID can be found in the application:didReceiveRemoteNotification: userInfo, `[userInfo objectForKey:@“pid”].

Declared In

MaaSAlerts.h

didRegisterForRemoteNotificationsWithDeviceToken:

Call inside application:didRegisterForRemoteNotificationsWithDeviceToken:

+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken

Parameters

devToken

A token that identifies the device to Apple Push Notification Service (APNS). The token is an opaque data type because that is the form that the provider needs to submit to the APNS servers when it sends a notification to a device. The APNS servers require a binary format for performance reasons.

Declared In

MaaSAlerts.h

getExtraInformationForPushID:success:failure:

Get extra push information associated for the specified push ID.

+ (void)getExtraInformationForPushID:(NSString *)pushID success:(void ( ^ ) ( NSDictionary *extraInformation ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

pushID

The ID of the push notification for which extra information is requested.

success

A block object to be executed when getExtraInformationForPushID:success:failure: succeeds. This block has no return value and takes one argument: the extra information received from the server. The return object will always be an NSDictionary.

failure

A block object to be executed when getExtraInformationForPushID:success:failure: fails. This block has no return value and takes one argument:, an NSError object describing the error that occurred.

Declared In

MaaSAlerts.h

getSubscriptionGroupsWithSuccess:failure:

Get subscription groups list. Returns an NSArray of available subscription groups or an NSError object.

+ (void)getSubscriptionGroupsWithSuccess:(void ( ^ ) ( NSArray *groups ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

success

A block object to be executed when getSubscriptionGroupsWithSuccess:success:failure: succeeds. This block has no return value and takes one argument: The groups received from the server, an NSArray object that contains the subscription groups in the following format {@"id" : @"12", @"name" : @"Subscription group name"}.

failure

A block object to be executed when getSubscriptionGroupsWithSuccess:success:failure: fails. This block has no return value and takes one argument:, an NSError object describing the error that occurred.

Declared In

MaaSAlerts.h

isOptIn

Check push opt-in status

+ (BOOL)isOptIn

Declared In

MaaSAlerts.h

serviceName

Returns ‘MaaSAlerts’.

+ (NSString *)serviceName

Declared In

MaaSAlerts.h

setDevelopmentModeEnabled:

Optionally called inside application:didFinishLaunchingWithOptions:. By default your application will use Apple’s production push notification servers. If you would like to use the sandbox push notificiation servers you would call [MaaSAlerts setDevelopmentModeEnabled:YES]. Note that even if development mode is enabled, push notifications will not work in simulator.

+ (void)setDevelopmentModeEnabled:(BOOL)enabled

Parameters

enabled

A boolean variable that indicates whether or not push development mode is enabled.

Declared In

MaaSAlerts.h

subscribeToGroupsWithIDs:success:failure:

Subscribe to a list of groups.

+ (void)subscribeToGroupsWithIDs:(NSArray *)groupIDs success:(void ( ^ ) ( ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

groupIDs

An array of 1 or more NSString objects that represent the group IDs that are being subscribed to.

success

A block object to be executed when subscribeToGroupsWithIDs:success:failure: succeeds. This block has no return value and takes no arguments.

failure

A block object to be executed when subscribeToGroupsWithIDs:success:failure: fails. This block has no return value and takes one argument:, an NSError object describing the error that occurred.

Declared In

MaaSAlerts.h