LiObjPushNotification Reference


Inherits From: NSObject
Declared In: LiObjPushNotification.h

Overview


Applicasa's LiObjPushNotification class aims to ease and enhance creating, sending, and receiving push notifications in an application. This class provides convenience methods only—it does not alter the way in which an application needs to be registered, or how an application should handle watching for received messages.

Developers are expected to fully understand Apple's Local and Push Notification Programming Guide


Tasks


Creating Push Notifications

+ pushWithMessage:sound:badge:andTag:
- initWithMessage:sound:badge:andTag:

Sending Push Notifications

- sendPushToUsers:withBlock:

Receiving Push Notifications

- initWithDictionary:
+ pushWithDictionary:


Properties


pushID

The push notification's ID value.

@property (readonly) NSInteger pushID;

badge

An NSInteger indicating what badge number should be added to the app icon.

@property (nonatomic) NSInteger badge;

tag

An NSDictionary providing additional data to the push notification payload.

@property (nonatomic, strong) NSDictionary *tag;

message

An NSString containing the push message that will be delivered to users.

@property (nonatomic, strong) NSString *message;

sound

An NSString containing the name of a sound file in the application bundle that will be played as an alert.

@property (nonatomic, strong) NSString *sound;


Class Methods


pushWithMessage:sound:badge:andTag:

Creates an autoreleased LiObjPushNotification object with the supplied parameters.

+ (LiObjPushNotification *) pushWithMessage:(NSString *)theMessage sound:(NSString *)theSound badge:(NSInteger)theBadge andTag:(NSDictionary *)theTag;

Parameters:

theMessage
An NSString containing the push message that will be delivered to users.

theSound
An NSString containing the name of a sound file in the application bundle that will be played as an alert.

theBadge
An NSInteger indicating what badge number should be added to the app icon.

theTag
An NSDictionary providing additional data to the push notification payload.

Return Value:

An autoreleased LiObjPushNotification object that can be sent to application users.

pushWithDictionary:

Creates an autoreleased LiObjPushNotification object when a push notification is received.

+ (LiObjPushNotification *) pushWithDictionary:(NSDictionary *)dictionary;

Parameters:

dictionary
An NSDictionary containing the complete push notification payload.

Return Value:

An autoreleased LiObjPushNotification object.

Discussion:

This method returns an autoreleased LiObjPushNotification object that can subsequently be used by an application to display received information to the user. Standard Apple push attributes alert, badge, and sound will be found in the object's message, badge, and sound properties respectively. Additioal payload data will be accessible via the tag property.


Instance Methods


sendPushToUsers:withBlock:

Sends an initialized LiObjPushNotification to the provided users array.

- (void) sendPushToUsers:(NSArray *)users withBlock:(SendPushFinished)block;

Parameters:

users
An NSArray of User objects to whom the push notification should be sent.

block
A block for handling the push notification response. Must match the signature (NSError *error, NSString *message, LiObjPushNotification *pushObject).

initWithMessage:sound:badge:andTag:

Initializes an LiObjPushNotification object with the supplied parameters.

- (id) initWithMessage:(NSString *)theMessage sound:(NSString *)theSound badge:(NSInteger)theBadge andTag:(NSDictionary *)theTag;

Parameters:

theMessage
An NSString containing the push message that will be delivered to users.

theSound
An NSString containing the name of a sound file in the application bundle that will be played as an alert.

theBadge
An NSInteger indicating what badge number should be added to the app icon.

theTag
An NSDictionary providing additional data to the push notification payload.

Return Value:

A reference to the initialized LiObjPushNotification instance.

initWithDictionary:

Initializes an LiObjPushNotification object when a push notification is received.

- (id) initWithDictionary:(NSDictionary *)dictionary;

Parameters:

dictionary
An NSDictionary containing the complete push notification payload.

Return Value:

A reference to the initialized LiObjPushNotification instance.

Discussion:

This method returns an initialized LiObjPushNotification object's reference that can subsequently be used by an application to display received information to the user. Standard Apple push attributes alert, badge, and sound will be found in the object's message, badge, and sound properties respectively. Additioal payload data will be accessible via the tag property.


  « Back to SDK Class List